Sending mail from mutt with queueing and multiple accounts/profiles?

I’m looking into upgrading my email setup. I use mutt, and need two features:

  • Local queueing of emails, so that I can write emails when offline, queue them, and send them later when I’m online.
  • Routing of emails through several remote SMTP servers, ideally depending on the From header, so that emails pass SPF/DKIM checks.

I currently use nullmailer, which does queueing just fine, but cannot apparently handle several remote SMTP servers.

There’s also msmtp, which can handle several “accounts” (remote SMTPs). But apparently not when using queueing using msmtpq.

What are you using yourself?

10 thoughts on “Sending mail from mutt with queueing and multiple accounts/profiles?

  1. I have a very similar (if not the same) setup: multiple accounts are synced automatically in the background with offlineimap, mutt is used for reading and writing with mutliple identities based on the folder I am in (which maps to the account). What I use for sending is postfix, which automatically queues. I tried to use msmtp but wasn’t happy over time with it (but can’t fully remember the details). Do you have any reason not to use a full MTA set up in a way that it only sends email and doesn’t receive?

  2. You mean with sender_dependent_relayhost_maps / sender_dependent_defaut_transport_maps ? That indeed looks like a solution I should explore.

  3. I am using msmtpq/msmtpQ with Mutt and several identities/smtp servers.

    Setting “set sendmail=msmtpQ -a ” in your Mutt configuration, where account is one of your configuration blocks for msmtp allows you to use this specific smtp server for a given message when the queue is purged.

  4. I would like to use sender_dependent_relayhost_maps as well with postfix but I would also like to rewrite the MAIL FROM SMTP header.
    email1, email2 -> SMTP X -> MAIL FROM = email1
    email3 -> SMTP Y -> MAIL FROM = email3

    I used to use “canonical_maps = hash:/etc/postfix/canonical” to rewrite the MAIL FROM to a single email for my Unix user but I don’t know how to recover that feature with the setup with multiple SMTP server and multiple identities to use at the MAIL FROM level.

  5. +1 for msmtp(q). I leave it up to the client to decide which relay to use. I use Gnus’s posting-styles.

  6. I run Postfix on my laptop. It takes care of offline queueing and forwarding to my account’s SMTP server.

    Mutt’s send-hooks can take care of both the From: header and the envelope From.

  7. I think OpenSMTPd would fit the bill, using a combination of the `sender` filter and `relay` directive.

    You’ll need your mutt to make the envelope sender the same as your From header, but that shouldn’t be too hard to do. OpenSMTPd will also allow you to fix the envelope up for other outgoing mail (for example, on my laptop, I rewrite the envelope to a fixed address for all system-generated mail).

    https://manpages.debian.org/stretch/opensmtpd/smtpd.conf.5.en.html#sender

  8. I’m just running exim on my laptop, with a bsmtp transport configured to bounce mail to my colo box via ssh. On the colo, the exim config there will send mail on via different routes based on the From: address. Works well for me…

Comments are closed.