2

I am trying to use mutt as my email client, and it works fine for my gmail account. But when I use my work email, it does not send the emails. It doesn't give any error, it just doesn't send them. The line in my .muttrc file that causes this problem is:

set smtp_url = "smtp://mail.my_work_email_server.com:587"

The behaviour does not change when adding the smtp_pass, nor does it by altering the name of the email server (i.e. using a 'fictional' server address).

  • What about smtp login? – Pavel Šimerda May 5 '14 at 18:55
  • That's really weird it doesn't give any error message. Are you sure smtp_url is set? Is it possible to confirm with mutt -D | grep smtp_url ? – derobert May 5 '14 at 18:58
  • yes, it's definitely set.... – user2426172 May 5 '14 at 19:07
  • Any messages in syslog? I suppose its possible it decided to write logs there... – derobert Apr 22 '15 at 19:27
3

Are you able to successfully send mail via SMTP with another mail client on that machine? Are you able to telnet to your SMTP server and establish a connection? Are you using STARTTLS?

In mutt, you use the protocol smtps to denote a connection that is secured from the beginning with TLS/SSL. If your mail server is expecting that (and many do these days), that could be your problem.

However, if your mail server expects to use STARTTLS, then you use the regular smtp:// protocol in smtp_url and make sure to set ssl_starttls=yes.

Here's an example telnet session which shows a mailserver that uses STARTTLS:

$ telnet smtp.example.com 587
Trying 127.0.0.1...
Connected to smtp.example.com.
Escape character is '^]'.
220 smtp.example.com ESMTP Postfix (Debian/GNU)
EHLO test
250-
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
  • Ok,I'm not an expert in this, so I'll try to give you as much information as possible: 1) I normally use Thunderbird for emailing, and my work account works fine (both receiving and sending). 2) I copied all the info (server name etc) from the Thunderbird account settings to my .muttrc file. 3) On the other hand, mutt works fine using my gmail account. 4) I could establish a telnet connection to my work email server. 5) I don't know how to use STARTTLS in mutt, although I do use it in Thunderbird. – user2426172 May 6 '14 at 2:16
  • If I understood you correctly, I should write something like set smtp_url = "smtps://mail.my_work_email_server.com:587" in my .muttrc file (same as with the gmail account). When I do so, I get the following error: gnutls_handshake: An unexpected TLS packet was received. – user2426172 May 6 '14 at 2:47
  • @user2426172: what happens if you run telnet mail.my_work_email_server.com 587 and then after the 220 welcome message type EHLO test? Do you get a 250-STARTTLS? – JoeNahmias May 6 '14 at 3:00
  • yes, I do get a 250-STARTTLS. I tried adding set ssl_starttls=yes to my .muttrc file, but to no avail. – user2426172 May 6 '14 at 4:35
3

I had the same thing and this is what worked for me.

set ssl_starttls=yes
set ssl_force_tls=yes

set imap_user = "user@example.com"
set imap_pass = "!HASHEDPASSWORD!"
set folder = imap://mail.example.com/
set spoolfile = imap://mail.example.com/INBOX

# SMTP user auth
# # fill in the right user and pass based on your setup
# # protocols: smtp for TLS (25/587), smtps for SSL (465)
set smtp_url = "smtp://$imap_user@mail.example.com:587"
set smtp_pass = "$imap_pass"

# Where to save copies of outgoing mail
set record = '+Sent'

What made it NOT work for me was the order in which things were in the config file and a definition for 'set record' to a folder which was a link to a non existing folder.

When answering 'no' to the question of creating the Folder it was hanging and no traffic was seen towards the SMTP server.

PS: check sourced config files, they might specify conflicting settings and/or in the wrong order.

HTH

  • How do you get a hashed password? – bgStack15 Feb 2 '17 at 16:52
0

Below config in ~/.muttrc works for me, for sending mail to gmail:

set from = "user@gmail.com"
set realname = "user"
set imap_user = "user@gmail.com"
set imap_pass = "pwd"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "imaps://imap.gmail.com/INBOX"
set postponed ="+[Gmail]/Drafts"
set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates
set smtp_url = "smtps://user@gmail.com@smtp.gmail.com:465/"
set smtp_pass = "pwd"
set move = no 
set imap_keepalive = 900
0

I realize this is an old thread, but yesterday I spent two hours tracking down why the above-mentioned configurations didn't work for me, and I want to share the solution to save other people time.

The problem was that I needed to accept the certificate from Google's SMTP server at least once, and this requires running mutt without its input redirected, otherwise mutt cannot prompt you to accept the certificate.

By the way, you should select (a) for always, in order for the certificate to be stored in .mutt/certificates. If you select (o) for once, it will use the supplied certificate, but not store it in .mutt/certificates.

So run mutt without redirecting the input (this includes piping to standard input), then accept the offered certificate always. After that, the next time you run mutt, it should just work because it is using the stored certificate.

0

I spent a whole day figuring this out and tweaking MANY combinations between different SSL/TLS and ports configurations with no success, until today I finally tried this specifically:

set ssl_starttls = no

It seems mutt's default behavior is to try STARTTLS, so you have to specifically tell it DON'T

No other configuration was needed besides the obvious smtp_url and smtp_pass. I can now perfectly send mail with this .muttrc

set ssl_starttls = no
set smtp_url = "smtp://user@example.com@mail.example.com:587/"
set smtp_pass = "password"

That worked with the Not recommended configurations of SSL from my email provider. I'm still not able to use the recommended config using 465 port.

This are all the configurations I have tweaked that affects sending mail, if any one else want to try:

set ssl_starttls = no    # apparently yes is default.
set ssl_force_tls = yes
set smtp_authenticators = "login"

set smtp_url = "smtp[s]://..."
set certificate_file = "~/.mutt/certificates"    # some recommend creating the file first: mkdir ~/.mutt && touch ~/.mutt/certificates

set ssl_verify_host = no
set ssl_verify_dates = no

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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