以为我会在Ubuntu上试用Mutt,并且在尝试使其工作了两天后,现在我陷入了这个错误。

Could not connect to smtp.gmail.com (Interrupted system call).

我在互联网上四处寻找试图解决的方法,但是找不到任何可以解决的方法。创建了~/.mutt~/.mutt/cache/文件夹。我认为msmtp没有问题,因为它没有在日志文件中添加任何内容。

这是我的.muttrc,当然没有密码:
set imap_user = "<my_email>@gmail.com"
set imap_pass = "<my_password>"
set smtp_url = "smtp://<my_email>@smtp.gmail.com:587/"
set smtp_pass = "<my_password>"
set from = "<my_email>@gmail.com"
set realname = "<my_name>"
set sendmail="/usr/bin/msmtp"

set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates

set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set trash = "imaps://imap.gmail.com[Gmail]/Trash"

#======================================================#
# Order of headers and what to show
hdr_order Date: From: User-Agent: X-Mailer \
          To: Cc: Reply-To: Subject:
ignore *
unignore Date: From: User-Agent: X-Mailer  \
         To: Cc: Reply-To: Subject:

#======================================================#
# which editor do you want to use?
# vim of course!
set editor="vim -c 'set tw=70 et' '+/^$' "
set edit_headers          # See the headers when editing

和我的.msmtprc
account default
host smtp.gmail.com
port 587
from "<my_email>@gmail.com"
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth on
user "<my_email>@gmail.com"
password "<my_password>"
logfile ~/.msmtp.log

现在这是真正的奇怪的东西... mutt能够收到新电子邮件,以及当我推迟电子邮件时,将其另存为草稿中的gmail,然后将其上传到gmail服务器。谢谢。

最佳答案

经过数天的搜索,我找到了解决方案。我需要将smtp网址更改为:

set smtp_url="smtps://<username>@smtp.gmail.com:465/"

电子邮件现在发送很好!

10-08 09:29