我尝试通过 cron 发送电子邮件,ssmtp
但收到错误:
授权失败(501 无法解码用户和密码)
ssmtp配置文件:
[email protected]
mailhub=smtp.zoho.com:465
rewriteDomain=zoho.com
UseTLS=Yes
[email protected]
AuthPass=*******
UseSTARTTLS=NO
FromLineOverride=yes
用户和密码正确。Zoho 仅支持简单身份验证,因此未设置 AuthMethod。
这个错误到底是什么意思?我该如何修复它?
答案1
我遇到了同样的问题,并且我通过将密码更改为一个简单的密码来修复了这个问题,只是为了测试(没有特殊字符)。
查看我的 /etc/ssmtp/ssmtp.conf:
mailhub=smtp.zoho.com:587
# I use my domain. First you have to config the MX records
rewriteDomain=<your domain>.com.br
UseSTARTTLS=YES
UseTLS=YES
AuthUser=<your user>@zoho.com
AuthPass=<your pass>
AUTH LOGIN
FromLineOverride=YES
查看我的 /etc/ssmtp/realiases:
#You have to verify your domain on Zoho and create an email to use
root:<your email>@<your domain>.com.br:smtp.zoho.com:587
看这里如何配置 MX 记录
之后你可以测试:
echo "Test message from Linux server using ssmtp" | sudo ssmtp -vvv [email protected]
结果:
[<-] 220 mx.zohomail.com SMTP Server ready September 27, 2016 8:09:04 PM PDT
[->] EHLO Shun
[<-] 250 SIZE 53477376
[->] STARTTLS
[<-] 220 Ready to start TLS.
[->] EHLO Shun
[<-] 250 SIZE 53477376
[->] AUTH LOGIN
[<-] 334 VXNlcm5hbWU6
[->] YW50b25pby5ldXN0YXF1aW9Aem9oby5jb20=
[<-] 334 UGFzc3dvcmQ6
[<-] 235 Authentication Successful
[->] MAIL FROM:<[email protected]>
[<-] 250 Sender <[email protected]> OK
[->] RCPT TO:<[email protected]>
[<-] 250 Recipient <[email protected]> OK
[->] DATA
[<-] 354 Ok Send data ending with <CRLF>.<CRLF>
[->] Received: by Shun (sSMTP sendmail emulation); Wed, 28 Sep 2016 03:09:04 +0000
[->] From: "root" <[email protected]>
[->] Date: Wed, 28 Sep 2016 03:09:04 +0000
[->] Test message from Linux server using ssmtp
[->]
[->] .
[<-] 250 Message received
[->] QUIT
[<-] 221 mx.zohomail.com closing connection