<<< Date Index >>>     <<< Thread Index >>>

[PATCH 0 of 2] Add sendbox/use_sendbox settings



I've been using Courier IMAP's Outbox feature for years with offlineimap:
    http://dev.gentoo.org/~agriffis/email/
    http://www.courier-mta.org/imap/INSTALL.html#imapsend

One could debate the merits of sending email via IMAP rather than SMTP
directly, but it has worked well for me.  Advantages are:
    - only a single connection to the server needed
    - don't need to reconfig local MTA to use the appropriate outgoing
      SMTP server to match my From address
    - don't need to send the message twice over the wire, i.e. once
      over SMTP and once over IMAP to put it in the "sent" folder
    - works well for offline situations, don't need to cook up
      separate offline methods for both IMAP and SMTP

To accomplish this, I set sendmail=~/bin/mailout which deposits the
mail into the appropriate local Outbox, then offlineimap syncs the
mailbox at the next opportunity.

A little while back, I decided that I'd like to use mutt with IMAP
directly on some client machines (workstations), and offlineimap on
other machines (laptops).  I rewrote my muttrc to be preprocessed with
m4, and everything was rosy, except for sending via Outbox...

The mailout script no longer works, because it needs to save to IMAP
rather than local maildir.  I want to use mutt's existing connection
to the server rather than re-implement IMAP in the script!  So
I needed to switch to a mutt-based method...

I tried setting sendmail=/bin/true and using fcc to deposit the mail
to the IMAP Outbox.  This hack generally works.  The fcc-status patch
is needed to prevent "Status: RO" (screws up the recipients that use
mboxes, the mail shows up as already-read).  Additionally it's
impossible to have more than one fcc set, so I faked it (when desired)
using write-fcc.  That's borked though because it lacks the
Message-ID, encryption/signing, date, etc!

Moreover this does not work for bouncing (resending) messages, because
that path calls mutt_invoke_sendmail directly, and of course no fcc is
done.

Finally I realized that these hackish methods were going nowhere fast,
so I implemented Outbox support directly in mutt.  I call it "sendbox"
because I think that's more explicit.  Additionally mutt already has
an internal variable Outbox that corresponds to the record setting,
and I wanted to avoid confusion.

To use this feature, one does something like:

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

...then all mail is sent by saving it to the Outbox instead of calling
sendmail.

There are two patches here, split for readability.  The first
implements sendbox on the normal send path.  The second patch provides
sendbox support to the bounce path.

Regards,
Aron