Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to send and e-mail from mutt from command line using following command:

mutt -F /my/path/to/muttrc -s "Hello" an@email.com < test.txt

But nothing happens. Mutt doesn't display any error but mail it's not sent.

Everything works fine if I enter interactive mutt using mutt command and send the e-mail from there.

In my muttrc I have configured a gmail account, like this:

account-hook    imaps://a_user@imap.gmail.com 'set imap_user=a_user@gmail.com imap_pass="password"'
folder-hook     'imaps://a_user@imap.gmail.com' 'set folder=imaps://a_user@imap.gmail.com/'
set folder=imaps://a_user@imap.gmail.com/
mailboxes +INBOX
set spoolfile = +INBOX
folder-hook    imaps://a_user@imap.gmail.com 'set smtp_url="smtps://a_user:password@smtp.gmail.com"'
folder-hook     'imaps://a_user@imap.gmail.com' 'set from=a_user0@gmail.com'
folder-hook    imaps://a_user@imap.gmail.com 'set realname="A Real Name"'

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
unset record
set timeout=15
set mail_check=60
set imap_keepalive = 900
unset imap_passive
set move = no
set sort = 'last-date-received'
set charset=utf-8
set locale=$LANG
send-hook "~f a_user@gmail.com" 'set signature="~/.mutt/signature"'
set editor = 'vim'
share|improve this question
up vote 2 down vote accepted

Looks like you're setting smtp_url only in a folder-hook. That means that its only set when you use that folder, and when you're using the non-interactive command line method, it never actually tries to access the folder, so smtp_url isn't ever set, so it has no idea what method to send messages. It might be defaulting to some other method (like piping to sendmail) and failing.

share|improve this answer
Thank you @jsbillings. It was exactly that :) – cram1010 Apr 13 '12 at 6:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.