当邮件服务器不在网络主机上时发送邮件和 MX 记录 [英] sendmail and MX records when mail server is not on web host

查看:33
本文介绍了当邮件服务器不在网络主机上时发送邮件和 MX 记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确信这是一个很容易解决的问题,但我整天都在努力解决这个问题.

This is a problem I'm sure is easy to fix, but I've been banging my head on it all day.

我正在为客户开发一个新网站.该网站位于(这是一个示例)website.com.我有一个 PHP 表单脚本,可以将访问者的请求通过电子邮件发送到 requests@website.com.

I'm developing a new web site for a client. The web site resides at (this is an example) website.com. I have a PHP form script to email visitors' requests to requests@website.com.

当我在不同域的临时服务器上编写此代码时,一切正常.当我将其移至 website.com 时,邮件消息从未到达.Web 服务器位于具有主要 ISP 的虚拟主机上.

When I coded this on a staging server on a different domain, all worked fine. When I moved it to website.com, the mail messages never arrived. The web server is on a virtual host with a major ISP.

从那时起,我学到了以下知识:我客户的邮件服务器是 Microsoft Exchange,实际位于他们办公室的一个盒子上.每当外界有人向 requests@website.com 发送电子邮件时,邮件就会到达.但是如果网络服务器发送到相同的电子邮件地址,它每次都会失败.这不是 PHP 问题.我将 shell 保护到 Web 服务器,并使用 sendmail 和 UNIX 邮件应用程序对此进行了测试.我还通过从 shell 发送各种电子邮件帐户来测试它.例如,我可以给自己发送电子邮件,而不会发送 website.com 域中的任何人.

Here's what I've learned since then: My client's mail server is Microsoft Exchange on a box physically in their office. Whenever someone on the outside world emails requests@website.com, the mail arrives. But if the web server sends to the same email address, it fails every time. This is not a PHP problem. I secure shell in to the web server and have tested this both with sendmail and the UNIX mail application. I've also tested it by emailing various email accounts from the shell. I can email myself, for example, just nobody at the website.com domain.

简而言之,当我登录到 website.com 时,发送到 requests@website.com、user@website.com、another_user@website.com 的邮件都失败了.所有其他地址都可以正常工作.我发现那些丢弃的电子邮件被路由到网络服务器的catchall"帐户,它们位于收件箱中.

In short, when I'm logged in to website.com, mail to requests@website.com, user@website.com, another_user@website.com all fail. All other addresses work fine. What I've discovered is those dropped emails are routed to the web server's "catchall" account where they sit in its inbox.

我在 website.com 上进行了 MX 查找.MX 记录指向 mailsec.website.com.我可以远程登录到 mailsec.website.com 的 25 端口并查看 SMTP 服务器.

I've done an MX lookup on website.com. The MX record points to mailsec.website.com. I can telnet to mailsec.website.com port 25 and see the SMTP server.

在我看来,website.com 在向 requests@website.com 发送邮件时没有进行 MX 查找.我的理论是它将域识别为本地域,看到没有请求"用户帐户可以将其传递到,并将邮件放入包罗万象的帐户中.我想要的是强制 sendmail 进行 MX 查找并将邮件发送到 Exchange 服务器.我在这里束手无策.我不知道该怎么做.

It appears to me that website.com isn't doing an MX lookup when it's sending mail to requests@website.com. My theory is that it recognizes the domain as local, sees that there's no "requests" user account to deliver it to, and drops the mail into the catchall account. What I want is to force sendmail to do the MX lookup and send the message on to the Exchange server. I'm at wit's end here. I can't figure out how to do this.

就此而言,我可能离这里很远,并且完全误诊了这一点.互联网邮件和 MX 对我来说一直是一门魔法,而我的无知肯定会在这个问题中体现出来.

For that matter, I may be way off base here and have misdiagnosed this entirely. Internet mail and MX has always seemed a black art to me, and my ignorance is certainly showing in this question.

推荐答案

我认为问题在于 sendmail(您的进程)正在与本地 sendmail 守护进程通信.本地 sendmail 守护进程认为,因为它是 website.com,它应该知道如何传递电子邮件.不幸的是,网络服务器上不存在 to 字段中的实际地址,因此它将其转储到catchall"邮箱中.您应该与您的 ISP 交谈并让他们更新其 sendmail 配置,以便发送至 ...@website.com 的邮件转发到邮件交换器,而不是在本地处理.

I think the problem is that sendmail (your process) is talking to the local sendmail daemon. The local sendmail daemon thinks that because it is website.com, it should know how to deliver the email. Unfortunately, the actual address in the to field does not exist on the web server and thus it dumps it in the "catchall" mail box. You should talk to your ISP and have them update their sendmail configuration so that mail addressed to ...@website.com gets forward to the mail exchanger instead of being handled locally.

这篇关于当邮件服务器不在网络主机上时发送邮件和 MX 记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆