M41 with J-type OD. The cover and shifter from your 4-speed will bolt up, but you may need to cope with an output flange that's too big to bolt to your drive shaft. The easiest fix is to get the front shaft from the donor car, and have a driveline shop weld its flange to your shaft.
The transition from D to J happened at the same time as the change from B18 to B20. A J-type has the solenoid on the left and the solenoid has two spade terminals. A D-type has the solenoid on the right and a single wire going into a rubber boot. You could actually use a D-type without problems and the flange is likely the right size as well, but it's not technically correct for a 240. The gearbox ratios are a bit close spaced, and the OD is geared taller than the J.
What you probably don't want is the M410, used in the B30-powered 164 (won't bolt up, in any case) and '70 1800E (will bolt up if you take the bellhousing too, but...). You can tell these definitively by the drain and fill plugs being on the left instead of the right.
Not a easy swap, the bellhousing is part of the trans like the M410 that was used on the 164 and 70's 1800. don't know if they can be reworked to use the M46. Why not just put a B21/23/230 in. It's a bolt in job, no mods!
No you use the mounts from the B21/23, they bolt to the same holes in the front crossmember! Best to get a whole wreck and remove all the parts.
If you do this, sell the B20 to a racer, as they are easy to convert to 2.1 liter.