这是一个相当长的问题,有一个长长的事情尝试和辛苦的列表,请容忍我。 总结是这个。
更多细节如下。 我在亚马逊的云端有一台机器,在这台机器上运行了大量的工作,并希望将状态邮寄给我。 我在工作时使用office365,所以我想通过office365中继邮件。 我最熟悉的后缀,所以我用它作为MTA。
configuration是ubuntu 12.04LTS ; 我已经安装了postfix和mail-utils。
对于这个例子,让我说我的公司是“ company.com ”,有问题的机器(通过弹性IP和DNS条目)被称为“ plaything.company.com ”。 主机名被设置为“ /etc/mailname ”, /etc/mailname
在玩物上,我有以下用户注册alpha , bravo和charlie 。
我有以下configuration文件。
alias_database = hash:/ etc / aliases
alias_maps = hash:/ etc / aliases
append_dot_mydomain = no
biff = no
config_directory = / etc / postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = plaything.company.com,localhost.company.com,localhost
myhostname = plaything.company.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [:: 1] / 128
myorigin = / etc / mailname
readme_directory = no
recipient_delimiter = +
relayhost = [smtp.office365.com]:587
sender_canonical_maps = hash:/ etc / postfix / sender_canonical
smtp_sasl_auth_enable =是
smtp_sasl_password_maps = hash:/ etc / postfix / sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_session_cache_database = btree:$ {data_directory} / smtp_scache
smtp_use_tls =是
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 =是
由于该机器被称为plaything.company.com我经历了注册所有适当的DNS条目,使office365承认我拥有plaything.company.com,并允许我创build一个名为[email protected]用户office365。
在office365中,我将[email protected]设置为另一个电子邮件地址[email protected] 。
然后,我做了以下sender_canonical
[email protected] [email protected]
我创build了一个sasl_passwd文件,其内容如下:
smtp.office365.com [email protected]:123456password123456
让我们只是说, [email protected]的密码是1234...456
使用所有这些设置,login为alpha和
电子邮件[email protected] 抄送: 主题:testing testing
整个事情奇妙地起作用。 电子邮件被postfix发送,TLS像冠军一样工作,authentication为daemon@...和在Office365的[email protected]得到一封电子邮件。
login时,问题出现在机器上。
发件人是[email protected]和office365说:
状态=退回(主机smtp.office365.com [132.245.12.25]说: 550 5.7.1客户端没有权限发送 这个发送者(回复到DATA命令的结尾))
这是因为我试图发送邮件作为bravo@...和authentication与office365作为daemon@... 它与alpha@...一起工作的原因是因为在office365中,我将[email protected]设置为具有另一个电子邮件地址[email protected] 。
迈克尔 ·埃里克森 在Office365的Postfix Relay中回答这个问题:
不要以Office365托pipe的电子邮件域中的用户身份向Office365发送邮件。 请使用子域名,例如[email protected]而不是[email protected]。 为services.mydomain.com或任何你决定使用的SPFloggingbuild立一个SPFlogging并不会有什么坏处。
不要作为Office365用户对mail.messaging.microsoft.com进行身份validation。 只需连接端口25,并将邮件传送到您的域名,因为任何外国的SMTP代理会做。
好的,我已经完成了#1,我有这些DNSlogging,但大多数情况下,他们不相关,一旦Office365认识到我拥有该域名。
以下是这些logging:
CNAMElogging: – msoid.plaything.company.com – autodiscover.plaything.company.com
MXlogging: – plaything.company.com(plaything-company-com.mail.protection.outlook.com)
TXTlogging: – plaything.company.com(v = spf1包括:spf.protection.outlook.com -all)
我已经尝试了#2,但不pipe我做了什么,office365只是吹走了与“未authentication”的连接。 我甚至可以尝试一个简单的telnet端口25,并尝试发送,它不工作。
250 BY2PR01CA007.outlook.office365.com Hello [54.221.245.236] 530 5.7.1 Client was not authenticated Connection closed by foreign host.
有没有人有这种configuration工作,在linux机器上的多个用户可以通过office365使用postfix中继邮件? 必须有人在做这个,他可以告诉我什么是我的设置错了…
我认为你需要退后一步:)
如果你是以bravo身份login玩的话,你真的需要从玩物发送的所有邮件作为[email protected]发送吗? 如果没有,只需发送所有邮件[email protected] ,请参阅主机上的Postfix没有一个真正的Internet主机名 。
如果你不能应用这个,那么你将需要依赖发件人的SASL地图 。 这会给你的设置增加一些复杂性,所以我会尽力避免这种情况。
最后但并非最不重要的是,如果plaything以[email protected]发送邮件,则需要调整myhostname和/或myorigin以及摆脱relayhost设置。 在这种情况下, plaything会直接传送所有的邮件,所有的优点和缺点如邮件服务器的信誉等等。