This is a post-weatherization photo of how a contractor in a local low income weatherization program boxed a bathroom fan. That's the fan buried in cellulose with a piece of tin laying loose on top of it. The fan is in complete contact with the insulation which, in my opinion, could lead to a fire and there certainly is no air sealing going on. Seriously shameful.
If it's just a bath fan, what's the fire risk? Do the manufacturer's instructions call for clearance to combustibles?
Ted, I was taught to box with 5/8" fire-rated drywall with a 3" clearance from any heat source. Once the box is fit into place it is foamed around the base. I tape my seams inside and out with approved foil tape. Some of the programs feel drywall is a mold risk, so they require boxing in metal stove pipe with a cap.
That looks like a regular bath vent not one of those heat lamp / vent combos.
If you have a heat lamp combo in there that might be a good precaution (check with the manufacturer) but for the rest there is not enough heat generated to cause an issue.
The big issue are recessed lights where you have a regular or CFL bulb pushing out 200+ degree heat inside the fixture itself
I will use a combination of tape, caulk & even foam around the outside of it - I never really touch the inside as that can screw with the UL labeling & besides that they are nearly impossible to get them clean enough for anything to stick long term
I tape the joints in the box with foil tape before I install the fan, then go in the attic after the drywall is in and foam the fan/drywall joint after the duct is attached and taped. I don't know how worthwhile it is, since a lot of air leakage tends to be inside the duct, in either/both directions, but if I can seal something, I do it.