如何解决如何使用ssmtp发送电子邮件
我正在尝试编写一个脚本来发送包含日志消息的电子邮件...
首先,我安装了 ssmtp
并配置了 /etc/ssmtp/ssmtp.conf
如下:
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=myname@gmail.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
# The address where the mail appears to come from for user authentication.
rewriteDomain=gmail.com
# The full hostname. Must be correctly formed,fully qualified domain name or GMail will reject connection.
hostname=ananas
# Use SSL/TLS before starting negotiation
TLS_CA_FILE=/etc/ssl/certs/ca-certificates.crt
UseTLS=Yes
UseSTARTTLS=Yes
# Username/Password
AuthUser=myname@gmail.com
AuthPass=mypassword
AuthMethod=LOGIN
# Email 'From header's can override the default domain?
FromLineOverride=yes
然后我试着给我发一封测试邮件
user@ananas:~$ echo -e 'Subject: test\n\nTesting ssmtp' | sendmail -v myname@gmail.com
[<-] 220 smtp.gmail.com ESMTP v20sm16357528wra.19 - gsmtp
[->] EHLO ananas
[<-] 250 SMTPUTF8
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
[->] EHLO ananas
[<-]
sendmail: (ananas)
我没有收到任何邮件。我做错了什么?
解决方法
ssmtp
几乎不再受支持。我尝试使用建议的包 msmtp
,它有效
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。