将服务器从 Ubuntu 10.04 升级到 12.04 后,postfix 不再通过 sendgrid.com 发送电子邮件。我关注了本指南大约 6 个月前,一切都运行正常,直到升级。现在它似乎无法使用 sendgrid 进行身份验证。
这是我尝试发送电子邮件时在系统日志中收到的错误。
May 22 10:19:55 server postfix/smtp[3844]: 983B11C5DA: to=<to address>,
relay=smtp.sendgrid.net[174.36.32.204]:587, delay=0.05, delays=0.01/0/0.04/0,
dsn=5.0.0, status=bounced (host smtp.sendgrid.net[174.36.32.204] said: 550 Cannot
receive from specified address <sendgrid username>: Unauthenticated senders not
allowed (in reply to MAIL FROM command))
这是来自 postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = no
config_directory = /etc/postfix
header_size_limit = 4096000
inet_interfaces = loopback-only
mailbox_size_limit = 0
mydestination = localhost, mylinode.members.linode.com
myhostname = hostname
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost = [smtp.sendgrid.net]:587
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = login
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sendgrid
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
任何帮助都将不胜感激。我很乐意发布任何其他日志或其他相关信息。
答案1
我遇到了类似的错误。我通过注释掉以下内容来修复它:
#default_transport = 错误 #relay_transport = 错误
答案2
引用自评论:
“事实证明,它不需要重新散列,但文件的格式不正确。它看起来像[smtp.sendgrid.net] username:password
但不需要主机名周围的括号。在我寻找答案的过程中,我发现它是必需的,甚至有人说将端口放在它后面,但两者都不是必需的。”