Mail with Wanderlust

This is a follow-up to this article about Gnus.

After a couple of years with Gnus and the combination Getmail + Procmail + msmtp over POP3, I decided it was time to put an end of the POP3 misery. I learned it the hard way: I was without home connection for a couple of days, so I had to go to the public library with the laptop. And my mails were scattered in the Gmail "All mails", or simply at home. Then a disk crash wiped out 2 weeks of mails (I usually am more diligent with the backup, but a series of coincidences delayed it and finally the dead machine took with itself a bunch of mails (nothing too important, but annoying nevertheless).

Also, Gnus became very slow lately, despite a local setup with Leafnode, probably because of the huge number of mail in the Maildir folders.

So, IMAP is the solution, and offlineimap the best solution to sync the mailboxes. The support for this in Gnus is not the best, simply because Gnus doesn't use the standard Maildir flags, but its own funny system, putting the flags and the marks in a .nnmaildir directory inside the mail directories... See here for details. I didn't want to use scripts and home-brew hacks to get it working, so I needed a new Emacs-based client (yes, I want to use Emacs at least to compose the mails). The bottom line would be to use mutt, but a bit of researches showed that there is an alternative: Wanderlust!

http://www.gohome.org/wl/

Well, the site looks kind of outdated (à la Xemacs), but the Debian Changelog for wl-beta, as the package is called, shows some activity.

The next step was to setup offlineimap and pull the existing history from my accounts. My configuration file is quite standard and doesn't need any note. Just sync the damned Maildir, remote and locale, without any filtering.

I hoped to avoid the use of msmtp and use the embedded MTA of Emacs, but gnutls decided not to collaborate, so I just reused the msmtp verbatim. Here you can find a sample.

The relevant snippet in ~/.wl to get it work together with msmtp is the following:

(setq wl-draft-send-mail-function 'wl-draft-send-mail-with-sendmail
      sendmail-program "/usr/bin/msmtp"
      message-sendmail-envelope-from 'header
      mail-envelope-from 'header
      mail-specify-envelope-from t)

(setq wl-draft-config-alist
      '(((string-match "^\\.Maildir1" wl-draft-parent-folder)
         (wl-from . "First name <firstname@gmail.com>")
         ("From" . wl-from)
         ("Fcc" . wl-draft-parent-folder)
         (wl-envelope-from . "firstname@gmail.com"))
        ; other accounts....
        ((string-match "^\\.Maild2" wl-draft-parent-folder)
         (wl-from . "Second name <secondname@gmail.com>")
         ("From" . wl-from)
         ("Fcc" . wl-draft-parent-folder)
         (wl-envelope-from . "secondname@gmail.com"))))

The envelope is extremely important to pick up the right SMTP server, to avoid Gmail doing its rewriting.

Please note that I choose to archive a copy of the outgoing message in the current folder with ("Fcc" . wl-draft-parent-folder).

Wanderlust offers some nice feature as the autorefiling using regular expression, integration with BBDB, crypt support, etc., but more important the manual is not 500 pages long. Terse, clear, not overwhelming.

More information here: http://emacswiki.org/emacs/WanderLust