我使用sendgrid设置Postfix就像这里的指南:https://developers.google.com/compute/docs/sending-mail?hl=en#postfixsendgrid
但它没有用。当我运行测试命令时:
printf 'Subject: test\r\n\r\npassed' | /usr/sbin/sendmail myemail@gmail.com
我在日志中收到此错误:
Sep 1 11:58:12 instance-1 postfix/qmgr[23412]: 8205A1E38: from=<*******@instance-1.c.mindful-vial-682.internal>, size=301, nrcpt=1 (queue active)
Sep 1 11:58:12 instance-1 postfix/smtp[23422]: warning: SASL authentication failure: No worthy mechs found
Sep 1 11:58:12 instance-1 postfix/smtp[23422]: 8205A1E38: SASL authentication failed; cannot authenticate to server smtp.sendgrid.net[208.43.76.147]: no mechanism available
Sep 1 11:58:13 instance-1 postfix/smtp[23422]: warning: SASL authentication failure: No worthy mechs found
Sep 1 11:58:13 instance-1 postfix/smtp[23422]: 8205A1E38: to=<myemail@gmail.com>, relay=smtp.sendgrid.net[208.43.76.146]:2525, delay=0.62, delays=0.01/0.02/0.59/0, dsn=4.7.0, status=deferred (SASL
authentication failed; cannot authenticate to server smtp.sendgrid.net[208.43.76.146]: no mechanism available)
答案 0 :(得分:5)
如果您使用的是debian,则还需要安装libsasl2-modules
:
apt-get install libsasl2-modules
这解决了我的问题。
答案 1 :(得分:2)
答案 2 :(得分:0)
尝试阅读[1]中记录的“No worthy mechs found”错误的解决方案。
亲切的问候 保罗
[1] - http://www.postfix.org/SASL_README.html#client_sasl_policy
答案 3 :(得分:0)
能够在Google Compute Engine上解决此问题的唯一方法是在postfix配置文件中静态链接我的sendgrid凭据:
# Sendgrid Settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:SENDGRID_ACCOUNT_EMAIL_HERE:PASSWORD_HERE
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
中找到了此解决方案