Sendmail在MXlogging中本地而不是MTA

好吧,我有一个名为websrv1.mydomain.com的框。 这是一个运行ubuntu,apache2,sendmail等的web服务器

我的电子邮件外包给第三方。 所以在我的DNS我有MX设置为mx.thirdparty.net。 我没有理由在我的networking服务器上接收收到的邮件,每封邮件都应该发送给第三方。 这工作正确接受从web服务器(又名通过cron或控制台)发送邮件。

所以从我的networking服务器,如果我发送电子邮件[email protected],它只是消失。 没有错误,没有任何信息,没有任何东西。 我可以发送到任何其他地址没有问题。 如果我发送到[email protected]它在本地交付这是很好的。

1)做nslookup显示mxlogging是正确的。
2)从sendmail -bt运行/ mx mydomain.com返回正确的结果。
3)运行sendmail -bv [email protected]返回:

  sudo sendmail -bv [email protected]
  [email protected] ...交付成果:邮件esmtp,主机mydomain.com。,用户[email protected]

4)运行3 [email protected],返回:

     3,0 [email protected]
     canonifyinput:me @ mydomain。  COM
     Canonify2input:我 
     Canonify2返回:我 
     canonify回报:我 
    parsinginput:我 
     Parse0input:我 
     Parse0返回:我 
     Parse1input:我 
     MailerToTripleinput:我 
     MailerToTriple返回:我 
     Parse1返回:$#esmtp $ @ mydomain。  com。  $:我 
    parsing返回:$#esmtp $ @ mydomain。  com。  $:我 

所以我很茫然 Sendmail似乎看到mxlogging,但它没有使用它。

检查以确保sendmail未configuration为处理本地域。 奇怪的消失行为可能​​发生,如果它试图处理电子邮件在本地,但它弹跳,但反弹也反弹。

你必须使用sendmail吗? 我用Postfix取代了所有的东西。 恕我直言,处理起来要容易得多。

如果你的sendmail.mc中有一个smarthost行,是括号里面的吗?

定义( SMART_HOST', [smtp.thirdparty.net]')dnl

这将导致sendmail跳过MXlogging查找并直接使用Alogging。 这可能是你想要在这种情况下。

你看过你的maillog日志文件吗? 那里可能有一些信息可以帮助您解决问题。

你可以做的另一个testing是将电子邮件作为该机器上的用户发送到你的@ domain.com上的一个帐户,然后通过查看你的maillog日志文件来查看它是否真的被sendmail删除。

我没有可以访问的ubuntu服务器,但是maillog文件应该是/ var / log / maillog

我做了什么来禁用本地交付。 我将使用example.com域。

要求:

  • example.com指向分配给其中一个eth接口的IP地址的条目。
  • / etc / hosts将example.com分配给与上面相同的IP地址
  • example.com指向Google服务器的MXlogging(ASPMX.L.GOOGLE.COM等)
  • 默认的sendmail安装(我的是在Ubuntu上)

脚步:

 vim /etc/mail/sendmail.mc 

最后:

 define(`MAIL_HUB', `example.com.')dnl define(`LOCAL_RELAY', `example.com.')dnl 

接着:

 sendmailconfig service sendmail restart 

testing:

 echo -e "To: [email protected]\nSubject: Test\nTest\n" | sendmail -bm -t -v echo -e "To: user\nSubject: Test\nTest\n" | sendmail -bm -t -v 

你应该看到它连接到谷歌服务器,然后你应该看到你的邮件被传递到你的谷歌收件箱。

如果你使用的是后缀

  1. 检查你的configuration: postconf | grep "^\(mydestination\|mydomain\|myhostname\)" postconf | grep "^\(mydestination\|mydomain\|myhostname\)"
  2. 如果您的mydestination包含您设置Google Apps的域:
  3. sudo vi /etc/postfix/main.cf并检查configuration,然后保存。
  4. 检查configuration(如步骤1),并重新启动后缀sudo service postfix restart (可选?)