13

I would like to use mutt continuously, allow me to explain what I mean with an example. My typical workflow is this:

  • Open up mutt
  • Compose a message
  • Press y to confirm send action
  • ... wait!
  • Compose another message
  • Press y to confirm send action
  • ... wait!

I am connected to my Gmail over IMAPS.

The problem is that often I need to reply to many messages in sequence and the pattern above is obviously unacceptable because the program does not return control to me whilst it is trying to deliver the message in the background. My time is valuable and I can't be waiting for a machine to do its job after I expressed my intent (to send) to it already, can I?


  • Can I configure mutt so that it does the message delivery in the background, immediately returning control to me to compose more messages?

My current workaround to this is running mutt within a tmux session with multiple windows, all running tmux and switching to another window to compose the next message as the previous is being delivered. This is a bad kind of "hack", I say.

My settings:


# Gmail configuration
set  folder            =  "imaps://imap.googlemail.com:993"
set  spoolfile         =  "imaps://imap.googlemail.com:993/[Gmail]/All Mail"
set  postponed         =  "imaps://imap.googlemail.com:993/[Gmail]/Drafts"
# set  record          =  "imaps://imap.googlemail.com/[Gmail]/Sent Mail"
set  record            =  "/home/tinosino/Sent_Messages.txt"
set  realname          =  "Tino Sino"
set  imap_user         =  "[email protected]"
set  imap_pass         =  ""
set  smtp_url          =  "smtps://[email protected]:465/"
set  smtp_pass         =  ""
set  from              =  "[email protected]"
set  sort              =  threads
set  editor            =  "vim"

What I have tried already:

  • I set sendmail_wait = -1 but the delay in sending a message remains
12
  • 10
    The recommendation you'll probably get from mutt folks is to use a separate MTA that can do queuing, and then set sendmail_wait to -1.
    – jw013
    Oct 5, 2012 at 14:46
  • How do I know which MTA is active now and could I integrate "another" MTA into my mutt workflow? (e.g. press reply in mutt, inside an IMAP folder and offload to sendmail perhaps?) Recommendations as to which MTA to use? Sample online .muttrc file with that MTA configured? Oct 5, 2012 at 14:57
  • 1
    It's also possible you are using the built-in SMTP, which is in newer versions of mutt. :set ?smtp_url to check, I think. I never figured out how to configure exim or sendmail for multiple account sending so I just use mstmp with the packaged msmtpQ script, although it's a bit lacking in functionality (in particular since it's not a daemon you have to check for and retry failed messages yourself).
    – jw013
    Oct 5, 2012 at 15:26
  • 1
    Yes, that setting means you are using mutt's built-in SMTP support to talk directly to gmail.
    – jw013
    Oct 5, 2012 at 15:43
  • 2
    @Robottinosino Of course sendmail_wait doesn't do anything when you are not using $sendmail. Instead, you are using mutt's very basic built-in SMTP client, and I don't think that supports background send. My comment said to "use a separate queuing MTA and then set sendmail_wait", meaning the first step is required for the second.
    – jw013
    Oct 5, 2012 at 16:08

1 Answer 1

6

Generally there are three different ways of sending mail with Mutt:

  • Using SMTP directly from within Mutt. This is what you are doing by specifying smtp_url. In this case Mutt will connect to smtp.googlemail.com and deliver through SMTP.

  • Using a sendmail program which will directly deliver the mail through an SMTP connection and only return after it's done. msmtp is an example of this type of program. You can set Mutt's sendmail_wait variable to specify how long it will wait for sendmailto return before giving up and putting delivery into the background.

  • Using and MTA which can do local queueing, e.g. Postfix. The sendmail program will usually return almost immediately when Postfix has added the mail to its local queue. You can configure Postfix to use Gmail as an SMTP relay, it will then forward all (non-local) mails to Gmail in the background.

1
  • A problem with the second proposal is that if msmtp fails, you get no notification if it's in the background. Do you know if that is fixable?
    – Sparhawk
    Nov 4, 2015 at 23:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .