我正在使用Postfix通过应用程序密码(激活了两步验证)发送电子邮件。
每次我使用sendmail命令测试发送邮件时,都会出现以下错误:
Action: delayed
Status: 4.7.14
Diagnostic-Code: X-Postfix; delivery temporarily suspended: SASL authentication
failed; server smtp.gmail.com said: 534-5.7.14
<https://accounts.google.com/signin/continue?...> Please log in via your web browser and?534-5.7.14 then try again.?534-5.7.14
这是我的邮件后缀配置:
main.cf
myorigin = /etc/mailname
mydestination = mydomain.com, localhost.fr, localhost
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
/etc/postfix/sasl/sasl_passwd:
[smtp.gmail.com]:587 admin@mydomain.com:application_password
以下是我如何使用sendmail:
sendmail -v ...
From: admin@mydomain.com
Subject: Test
This is a test mail
.
有什么想法吗?谢谢!