Much more complete setup instructions than Google’s own. By mapping Apple Mail’s special folders (Drafts, Trash, Spam) to Gmail’s built-in special folders, the “right thing” just happens. E.g., all of your sent mail goes into the same Sent Mail mailbox, whether you sent it from Mail on your Mac, MobileMail on your iPhone, or Gmail’s web interface.
[Soon, very soon…]
Source: Daring Fireball