Which Gmail SMTP port should I use in Mutt's smtp_url configuration option? I noticed that port 465 only works with smpts://..., while port 587 only works with smtp://... (by "works", I mean the ability to send emails without encountering any error messages in Mutt). What is the difference between the two ports? Which should I use?

Should I use this:

set ssl_force_tls = yes
set smtp_url = "smtps://my-username@gmail.com@smtp.gmail.com:465/"

Or this?

set ssl_force_tls = yes
set smtp_url = "smtp://my-usernamegmail.com@smtp.gmail.com:587/"

1 Answer 1


Port 465 is for implicit TLS while port 587 is for STARTTLS. The prefer approach is to use port 587. Use port 465 if port 587 fails.

Tl;dr Use port 587 if you can, 465 if you can’t, 25 if you must.

Port 587 is technically correct, the best kind of correct. However, many ESPs have adopted implicit TLS on port 465. While you can send email over port 25 and 2525, it’s much more secure to have the messages encrypted. This makes port 587 the preferred option for sending, with port 465 as a close second.

These ports are not specific to Gmail but well-known ports also used by other email service providers.

Source: What’s the Difference Between Ports 465 and 587?

  • Could you explain why port 465 requires smtps://... while port 587 requires smtp://... in Mutt's smtp_url configuration option?
    – Flux
    Apr 2, 2021 at 7:29
  • It is because of what TLS method is used. Implicit TLS (also known as SSL/TLS) requires smtps whereas STARTTLS does not. STARTTLS is superior over SSL/TLS though.
    – LPChip
    Apr 2, 2021 at 7:35
  • @Flux By default, port 465 is usd=ed with smpts while port 587 does not. It is not Mutt specific. Apr 2, 2021 at 7:37

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.