发送邮件时,Mutt遇到SMTP TLS错误。

当我尝试发送邮件时,出现以下错误:
gnutls_handshake:收到了意外的TLS数据包。
这是我的.muttrc文件(myname、myaddress和mymail是占位符):
# Automatically log in to this mailbox at startup
set imap_user="myname"
set imap_pass=""
set spoolfile="imaps://imap.myaddress/Inbox"
set folder="imaps://imap.myaddress/Inbox"
set record="=Sent"
set postponed="=Drafts"

# define how to send mails
set smtp_url="smtps://$imap_user:$imap_pass@smtp.myaddress:587"

# activate TLS if available on the server
set ssl_starttls=yes

# always use SSL when connecting to a server
set ssl_force_tls=yes

# wait to enter mailbox manually
set imap_passive

# Automatically poll subscribed mailboxes for new mail (new in 1.5.11)
set imap_check_subscribed

# Reduce polling frequency to a sane level
set mail_check=60

# And poll the current mailbox more often (not needed with IDLE in post 1.5.11)
#set timeout=10

# keep a cache of headers for faster loading (1.5.9+?)
#set header_cache=~/.hcache

# Display download progress every 5K
set net_inc=5

# Cancel a message when subject is blank
set abort_nosubject=yes

# Set default editor
set editor="gvim -v"

# Asks to include message when replying
set include=ask-yes

# Asks to postpone a message when not sent
set postpone=ask-yes

# Ask before printing
set print=ask-yes

# set from to ensure mutt doesn't put user@localhost.localhost 
set from="myemail"
set use_from=yes
set envelope_from="yes"

可能是与服务器的不兼容性问题。如果不了解服务器的情况,回答这个问题会很困难。你可以尝试使用其他提供商的账户(比如创建一个临时的Gmail地址)来测试一下吗? - Gilles 'SO- stop being evil'
我遇到过这个问题,不知何故,在465端口上好像正常工作。 - user43185
1个回答

当使用端口587上的smtp提交时,smtp_url的值应该以"smtp://"开头,而不是"smtps://"。同样重要的是确保ssl_starttls设置为"yes",就像上面的配置正确地做到的那样。
在设置自己的服务器时,我遇到了完全相同的问题。通过对客户端和服务器端的日志进行访问,很明显这肯定是一个客户端问题。
smtps开头的配置选项告诉mutt打开与服务器的SSL加密连接。然而,服务器期望的是一个明文的SMTP会话,在客户端和服务器完成一些协商后转变为加密。

2如果我对此(刚刚测试过)的理解是正确的,那么同样适用于set folder="imaps://这个条目。它应该是set folder="imap:。例如:set folder = "imap://mail.domain.ext:143/" - Nikos Alexandris
@NikosAlexandris 请注意:imap(143),imaps(993),smtp(25),smtps(465)。虽然可以向某些imap服务器运行starttls,但imap通常没有对应于smtp提交(587)的内容。 - sampi
2021年(Ubuntu Focal Fossa)- smtps:// -> smtp://,端口号为587。谢谢! - MarcoZen