Score:1

Mutt stopped sending email

cn flag

I'm using mutt to send mail like this:

mutt -s "Subject" email@gmail.com <<< "Text"

A few days ago, mutt stopped working and now I am getting this error:

msmtp: cannot read from TLS connection: the operation timed out
msmtp: could not send mail (account default from ~/.msmtprc)
Error sending message, child exited 74 (I/O error.)
  • version: Mutt 1.9.4

  • /.muttrc:

set sendmail="/usr/bin/msmtp"
set use_from=yes
set from=my.email@gmail.com
  • /.msmtprc:
defaults
logfile ~/msmtp.log
account gmail
auth on
host smtp.gmail.com
from my.email@gmail.com
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
user my.email@gmail.com
password "mypassword"
port 587
account default : gmail

What I've done:

I created an application specific password for Mutt on Google with 2FA but am still getting the same error.

The output of telnet and ping command shows a successful connection to the SMTP server of Gmail (smtp.gmail.com) on port 587.

Switch to port 465 and getting: msmtp: the server sent an empty reply with code 76 (Remote protocol error.)

Both port 587 and 465 works fine with swaks -tls, email successful delivered.

raj avatar
cn flag
raj
"timed out" suggests you cannot connect to port 587 on smtp.gmail.com. Did you check (even with telnet) that you are actually able to connect from your machine? Can some firewall be in place?
Matias N Goldberg avatar
vg flag
I'm not sure why it worked before. Google only allows OAuth2 authentication and rejects password based auth for email clients
raj avatar
cn flag
raj
@MatiasNGoldberg It can work with an application password, if you have one defined for your Google account (must have 2FA enabled on Google account, don't understand why, as these two have nothing to do with each other)
Matias N Goldberg avatar
vg flag
I ses, if you use app password then it may work, or it may break from Google's side. Because the SSL is timing out, it's possible the error is different but reported incorrectly. The root auth could be out of date, the clock could be wrong, your certs could be expired, or a newer algorithm is used which your SSL client doesn't support
andrew.46 avatar
in flag
@s3idani It would be very useful to run the following and post the terminal output in your question: `echo "Hello there" | msmtp --debug my_email@gmail.com` . Making the obvious substitution of your own 'testing' email address... Here is an example of a correctly working output on my own system: https://pastebin.com/4Jg9Nt8u
s3idani avatar
cn flag
@andrew.46 A successful connection to the SMTP server already mentioned. BTW, i can send mail via `swaks` through both port 587 and 465 without any issue.
Score:1
cn flag

I had this problem recently too (my existing config just stopped working one day in March 2023). I found this page to get me going, in particular:

set from = "your_email_address"
set realname = "Your Name"

# Gmail
set imap_user = "your_email_address"
set smtp_url = "smtps://YOUR_EMAIL@smtp.gmail.com:465/"
set smtp_authenticators = 'gssapi:login'
set imap_pass = "your_app_specific_password"
set smtp_pass = "your_app_specific_password"

# Ensure TLS is enforced
set ssl_starttls = yes
set ssl_force_tls = yes

It seems to me that it was the TLS stanza that fixed my issue. HTH you!

Organic Marble avatar
us flag
I have mutt working with gmail, and I don't have those TLS entries. However, it's possible that Google has not yet rolled the changes out to my account. Thanks for your post, +1
SD Allen avatar
cn flag
@OrganicMarble Probably, I saw mutt users complaining about this whilst my old config was working almost a year ago if memory serves. Then it bit me. :-) Google, like most big entities, do rollouts gradually methinks.
Score:0
uy flag
  • You might not be able to connect to port 587 on that host ( rate limits ? ) , ask your ISP if this problem persists
  • If port 465 is open from your side you may use the proper ssl settings
    # Use TLS on port 465
    port 465
    tls on
    tls_starttls off
    
s3idani avatar
cn flag
I can send mail via `swaks` through both port 587 and 465 without any issue. my ssl settings are the same in `mutt`
SD Allen avatar
cn flag
No solution as yet? I've been bitten by this issue too.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.