n01senet

Scratching the mutt, part 2: Patch and configuration

This is part 2 of a series that started here.

Before jumping into the patch and configuration details for using sendbox, let's take one step back and review the reasons for sending via IMAP. Sending email via IMAP gets mixed reviews in the community because it is non-standard, seldom supported by mail user agents (such as mutt), and supported by few IMAP servers (I'm only aware of Courier IMAP). The argument is that mail should be sent via SMTP and received via IMAP, and isn't that good enough?

I think there are good reasons to consider using IMAP for sending:

For me, these reasons trump the naysayers' arguments. Overall, sending email via IMAP is more elegant than splitting the operations between IMAP and SMTP, and elegance in software attracts me irresistably.

Let's start with the patch then talk about configuration details to make use of it. After all, the patch introduces latent functionality that won't take effect unless you change your configuration. But configuration is useless without the patch.

Obtaining a patched mutt

Here are three options for obtaining a patched mutt:

  1. If you're on Gentoo, use mercurial to fetch the n01se.net overlay and use emerge:
    hg clone http://n01se.net/gentoo/overlay overlay-noise
    export PORTDIR_OVERLAY="$PWD/overlay-noise $PORTDIR_OVERLAY"
    emerge mutt
    
  2. If you're on Debian, use my n01se.net apt repository:
    echo deb http://n01se.net/agriffis/debian sid main >> /etc/apt/sources.list
    echo deb-src http://n01se.net/agriffis/debian sid main >> /etc/apt/sources.list
    apt-get update
    apt-get install mutt
    
  3. Apply the patches and build it yourself. This patches was made on 1.5.12 but applies cleanly and works on 1.5.13 too.
    wget http://n01se.net/agriffis/mutt/mutt-1.5.12-sendbox.patch
    

Configuring your Outbox in mutt

There are three ways to use Courier's Outbox (if you learn of another IMAP server that supports the Outbox concept, I'd love to hear about it). The first way is to simply specify it in your configuration. For an IMAP configuration, that would be:

set sendbox=imaps://imap.domain.com/INBOX/Outbox
set use_sendbox=yes

This simplistic configuration works if the administrator of your mail server has enabled Outbox by default. Unfortunately this is seldom the case. More commonly, you'll need to the second way, which is to ssh into the server and start imapd yourself to enable Outbox. This is simpler than it sounds, just add to the above:

set tunnel="ssh -q server.domain.com   env OUTBOX=.Outbox SENDMAIL=/usr/sbin/sendmail /usr/sbin/courier-imapd .maildir"

To make this work with multiple servers, you can use account hooks.

If you're an offlineimap user, your offlineimaprc should have something like this:

[Account email]
localrepository = local
remoterepository = remote

[Repository local]
type = Maildir
localfolders = ~/mail
sep = .

[Repository remote]
type = IMAP
preauthtunnel = ssh -q server.domain.com   'env OUTBOX=.Outbox SENDMAIL=/usr/sbin/sendmail /usr/sbin/courier-imapd .maildir'
nametrans = lambda foldername: re.sub('^INBOX\.', '', foldername)

and your muttrc can then contain simply:

set sendbox=~/mail/Outbox
set use_sendbox=yes

Just don't forget to run offlineimap after sending mail from mutt, otherwise it won't leave your local Outbox!

 




<< Home
A community blog by the members of n01se.net

ARCHIVES
May 2006 / June 2006 / July 2006 / October 2006 / February 2007 / May 2007 / July 2007 / February 2008 / March 2008 / May 2008 /


Powered by Blogger