使用MSMTP通过Exchange服务器发送电子邮件

我有一个PHP Web应用程序设置,当用户提交表单时,发送来自[email protected]的确认电子邮件,并将来自同一电子邮件地址的查询详细信息发送到预定义的邮箱。 它运行在Debian Wheezy服务器上。

在开发中,我使用了一个MSMTP的Gmail帐户,它很容易build立和运行良好。 但是,我们很快就会开始使用,并且希望将其configuration为通过该域的现有邮件服务器进行发送。 但是,邮件服务器使用MS Exchange,而Googlesearch在使用Exchange与MSMTP时没有显示出太多内容。

理想情况下,我想修改MSMTPconfiguration,以便它可以通过现有的Exchange发送电子邮件,就像我已经在做,但我似乎无法得到它正确configuration。 这是我的/ etc / msmtprc:

  # ------------------------------------------------------------------------------ # msmtp System Wide Configuration file # ------------------------------------------------------------------------------ # A system wide configuration is optional. # If it exists, it usually defines a default account. # This allows msmtp to be used like /usr/sbin/sendmail. # ------------------------------------------------------------------------------ # Accounts # ------------------------------------------------------------------------------ # Main Account defaults tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt account [email protected] host domainname.co.uk port 25 #auth on from [email protected] user username password password logfile /var/log/msmtp.log # ------------------------------------------------------------------------------ # Configurations # ------------------------------------------------------------------------------ # Construct envelope-from addresses of the form "[email protected]". #auto_from on #maildomain fermmy.server # Use TLS. #tls on #tls_trust_file /etc/ssl/certs/ca-certificates.crt # Syslog logging with facility LOG_MAIL instead of the default LOG_USER. # Must be done within "account" sub-section above #syslog LOG_MAIL # Set a default account # ------------------------------------------------------------------------------ 

以下是我在/var/log/msmtp.log获得的错误消息:

 Sep 23 11:34:44 host=username.co.uk tls=on auth=on user=username [email protected] [email protected] errormsg='the server does not support TLS via the STARTTLS command' exitcode=EX_UNAVAILABLE 

任何人都可以指出我的错误在哪里? 我想这可能是安装Postfix,设置为空客户端,并将服务器添加到MXlogging可能会更好,但我更喜欢这样做,所以发送的电子邮件由Exchange服务器保留。

服务器不支持TLS通过STARTTLS命令

这是你的错误…所以你的Exchange服务器似乎没有正确安装TLS。

  1. 通过端口25 Telnet到Exchange服务器

  2. inputehlo,如果响应中列出“250-STARTTLS”,则提供Opportunistic TLS。

如果没有,则需要在接收连接器上启用TLS。

Set-ReceiveConnector“ReceiveConnectorName”-DomainSecureEnabled $ true -AuthMechanism TLS

但是,首先要了解您在做什么,因为接收连接器可能用于其他入站通信,并且不会强制TLS,因此请阅读以下Technet文章!

有关在Exchange上设置相互TLS的更多信息,请参阅此处: http : //technet.microsoft.com/zh-cn/library/bb123543.aspx

否则,如果您愿意,可以在MSMTP中禁用TLS。