After takeoff smelled fuel in the cockpit. Declared an emergency and landed. After shut down it was determined a door pin on the bottom was not latching completely only partially sealing the door allowing exhaust gasses into the cabin.