我试图在Linux机器上安装Postfix服务器,以将所有邮件中继到我们的Office365(Exchange,由Microsoft托管)邮件服务器,但是,我不断收到有关发送地址的错误消息:
BB338140DC1:to = relay = pod51010.outlook.com [157.56.234.118]:587,延迟= 7.6,延迟= 0.01 / 0 / 2.5 / 5.1,dsn = 5.7.1,状态为退回(主机pod51010.outlook.com [ 157.56.234.118]说:550 5.7.1客户端没有作为该发送者发送的权限(以回复DATA命令的结尾)
Office 365要求MAIL FROM和From:标头中的发送地址与用于身份验证的地址相同。我已经尽我所能在配置中想到的一切来使此工作正常。我的postconf -n:
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
debug_peer_list = 127.0.0.1
inet_interfaces = loopback-only
inet_protocols = all
mailbox_size_limit = 0
mydestination = xxxxx, localhost.localdomain, localhost
myhostname = localhost
mynetworks = 127.0.0.0/8
recipient_delimiter = +
relay_domains = our.doamin
relayhost = [pod51010.outlook.com]:587
sender_canonical_classes = envelope_sender
sender_canonical_maps = hash:/etc/postfix/sender_canonical
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = login
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_tls_loglevel = 1
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
/etc/postfix/sender_canonical
:
www-data address@mydomain.com
root address@mydomain.com
www-data@localhost address@mydomain.com
root@localhost address@mydomain.com
同样,sasl_passwd
将设置为正确的凭据(使用swaks对其进行多次测试。)身份验证有效,并在from头正确时发送消息(也使用swaks进行了测试)
电子邮件来自PHP,因此我也尝试过更改sendmail路径,php.ini
以使用通过-f传递正确的发件人地址
因此,由于某种原因,来自www-data和root的邮件没有将from字段重写为Office 365的要求,因此它不会发送邮件。
有任何可以帮助我设置此中继的postfix专家吗?
Jan 9 11:03:11 isvahlrtk01 postfix/smtp[12841]: connect to pod51017.outlook.com[157.56.250.182]:587: Connection timed out