Can mutt send mail from command line without command line parameters, with subject, cc, bcc, reply-to, in-reply-to all defined inside mail.txt file with body of the message too (the same file format like mutt opens to me when i press m-send mail, or r-reply to mail).

... So that I can:

  • press 'r' on received mail, prepare my reply message, save it with ':w ~/preparedmail.txt' in vim ... cancel sending
  • and than run $ at 8:00 <<< "mutt < ~/preparedmail.txt"

... or is there other tool that will accept this file format. Or other way to achieve this.

  • 1
    if you can run at 8:00 am <<< mutt , what's the problem with using command-line options, e.g. running at 8:00 am <<< cat ~/preparedmail.txt | mail -s subject [email protected] ?
    – cas
    Commented Nov 6, 2015 at 6:45
  • @cas it is grate when i want to send new message. But when i want to REPLY there are special headers that i want to invoke, like in-reply-to: hexNumbersLine ...and mutt itself prepare all that well in interactive use with 'r' shortcut, it also prepares 'include original message' and stuff.
    – MetNP
    Commented Nov 6, 2015 at 18:36
  • yes. you can write the msg in mutt, and save it to a file. you can use any mail program (mail, sendmail, a perl script, etc) to send it.
    – cas
    Commented Nov 6, 2015 at 21:50
  • @cas hm, sorry, so you actually meant 'mail' not 'mutt' inside your first comment. ok i will just find out what is most easy to configure for imap.
    – MetNP
    Commented Nov 7, 2015 at 1:04
  • what's imap got to do with it? you're saving your edited msg to ~/preparedmail.txt
    – cas
    Commented Nov 7, 2015 at 1:10

2 Answers 2


If you are using sendmail or postfix to deliver the mail, you can use

sendmail -t <~/preparedmail.tx

and it will extract the destination recipient(s) from any To: Cc: or Bcc: header lines in the file (upto the first blank line) and send the file as mail.

For people having configured a tool like mutt to send mail directly, an easy solution is to use msmtp, a program to send a prebuilt mail which also takes -t like sendmail to get the recipients, and is much easier to configure for smtp with credentials than postfix or sendmail. Here is an example ~/.msmtprc to send mail to gmail:

account gmail
 host smtp.gmail.com
 port 587
 tls on
 # from [email protected]
 auto_from on
 auth on
 user [email protected]
 # password mypassword
 passwordeval gpg -d ~/.msmtp.password.gpg

account default : gmail

Don't forget to chmod og= ~/.msmtprc.

  • nice, but configuring sendmail (which is also mail-server as i understand) for imap, than credentials... seems little complicated
    – MetNP
    Commented Nov 6, 2015 at 18:32
  • I agree. you could also look at msmtp, a program to send a prebuilt mail which takes -t like sendmail, and is much easier to configure for smtp with credentials than postfix or sendmail.
    – meuh
    Commented Nov 7, 2015 at 13:53
  • i am marking your answer as correct, because of now mentioning MSMTP too. For my situation (using external smtps's not own mail-server), msmtp is the BEST tool... maybe you should add that info inside 'for us without sendmail/postfix/exim ambitions', for external smtps like mutt+gmail users.
    – MetNP
    Commented Nov 8, 2015 at 1:08

The mutt command supports a -H option, with these docs:

-H draft
      Specify  a  draft  file which contains header and body to use to
      send a message.

You can create one of these draft files "by hand" if you want, but I believe it is the same format that Mutt uses when "postponing" an email (sometimes called a "draft").

In Mutt, you can author an email, then use P to postpone it — this will create the file with headers included. The defalt location it is saved on my system is ~/postponed, but you can find the path inside Mutt with :echo $postponed.

Note: that file will contain multiple emails, if you have multiple postponed.

You must log in to answer this question.

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