Thursday, January 10, 2008

Like many folks, I use Google for more and more. When I noticed Google's announcement that Gmail supports IMAP, I knew I could read my Gmail from Emacs.

The question was, how do you set up the integration? The Emacs wiki had instructions on how to read email, which worked nicely. But I wanted to enable Gmail to gather the mail I sent from Emacs into its conversation groups (it's no Gnus threading, but it's a start). So how to enable that? At first I automatically Bcc'ed my Gmail account, but that was hacky. Then I noticed Gmail lets you use their SMTP server.

I found some documentation on how to use it, but it didn't work for me (wrong ports evidentially), and it was integrated differently than what I wanted.

So I used my favorite Emacs lisp feature, advice, and wrote the following snippet. It checks to see if the 'From:' address is a gmail address, in which case it uses Gmail's SMTP server.