我试图在Linux上设置一个Postfix服务器来将所有的邮件转发到我们的Office365(Exchange,由Microsoft托pipe)邮件服务器,但是我一直收到一个有关发送地址的错误:
BB338140DC1:to = relay = pod51010.outlook.com [157.56.234.118]:587,delay = 7.6,delay = 0.01 / 0 / 2.5 / 5.1,dsn = 5.7.1,status = bounced(host pod51010.outlook.com [ 157.56.234.118]说:550 5.7.1客户端没有权限发送作为这个发送者(答复到DATA命令结束))
Office 365要求MAIL FROM和From:标头中的发送地址与用于authentication的地址相同。 我已经尝试了一切,我可以在configuration中想到这个工作。 我的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 [email protected] root [email protected] www-data@localhost [email protected] root@localhost [email protected]
此外, sasl_passwd设置为正确的凭据(使用swaks多次testing它们)。身份validation正常工作,并在标头正确时发送消息(也使用swaks进行testing)
电子邮件来自PHP,所以我也尝试改变php.ini的sendmailpath,使用正确的地址通过-f
因此,出于某种原因,来自www-data和root的邮件没有将from域重写为Office 365满意,并且不会发送邮件。
任何后缀的大师可以帮助我设置这个接力?
以防万一以后有人遇到这种情况。 我终于得到一个适当的电子邮件中继工作。 这个问题与使用旧版本的后缀有关,后者以Office 365不喜欢的方式格式化信封中的“FROM”元素。 将Postfix更新到2.9或更高版本(并使用类似上面的configuration)解决了这个问题。
解:
不要以Office365托pipe的电子邮件域中的用户身份向Office365发送邮件。 请使用子域名,例如[email protected]而不是[email protected]。 为services.mydomain.com或任何你决定使用的SPFloggingbuild立一个SPFlogging并不会有什么坏处。
不要作为Office365用户对mail.messaging.microsoft.com进行身份validation。 只需连接端口25,并将邮件传送到您的域名,因为任何外国的SMTP代理会做。
我发现一些SASL授权模块丢失了。 以下修复它:
yum install cyrus-sasl-plain cyrus-sasl-scram cyrus-sasl-md5 cyrus-sasl-ntlm
( 普通模块可能就够了)