我一直在尝试按照本指南来设置 msmtp,但它仍然无法正常工作。我在 /etc/msmtprc 和 ~/.msmtprc 中都有 msmtprc 文件,其内容完全相同
# Set default values for all following accounts.
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
# Gmail
account gmail
host smtp.gmail.com
port 465
tls_starttls off
from [email protected]
user [email protected]
password <app password>
# Set a default account
account default: gmail
我已经安装了 msmtp-mta 和 s-nail,但是/etc/mail.rc 不存在
我的别名文件包含一个条目
admin@momspi:~ $ cat /etc/aliases # See man 5 aliases for format postmaster: [email protected]
但是当我去测试它时,它失败了
admin@momspi:~ $ echo "hello there username." | msmtp -a default [email protected]
msmtp: authentication failed (method PLAIN)
msmtp: server message: 535-5.7.8 Username and Password not accepted. For more information, go to
msmtp: server message: 535 5.7.8 https://support.google.com/mail/?p=BadCredentials s9-20020a170902c64900b001ec6bab93cdsm428323pls.15 - gsmtp
msmtp: could not send mail (account default from /home/admin/.msmtprc)
端口应该是587
用户名不应该是电子邮件
tls_starttls 应该打开
似乎已经修好了