电子邮件从具有不同IP的专用服务器发送出去
我们在一台专用服务器上托管了三个域,每个域都有自己的专用 IP。
域 A - 具有服务器主 IP 地址(默认服务器 IP)
域 B - 有自己的 IP 地址
域 C - 有自己的 IP 地址
如果电子邮件从域 B 发出,则它在传出时使用域 A IP 地址,这使得来自域 B 使用 PHP 的电子邮件直接进入 Gmail 等的垃圾邮件箱
。如何根据 PHP 中电子邮件的来源更改源 IP?我们应该改变什么来解决这个问题?
We have three domains hosted on one dedicated server each with its own dedicated IP.
Domain A - Has the server primary IP address (default server IP)
Domain B - Has its own IP address
Domain C - has its own IP address
If an email goes out from Domain B then it uses the Domain A IP address in outgoing and this makes emails from Domain B using PHP go straight to spam box of Gmail etc.
Is there any way to change the source IP depending on where the email originates from in PHP? What should we change to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这与 PHP 无关。
不,您不能按照您建议的方式欺骗地址 - 但电子邮件被归类为垃圾邮件的原因是因为您只在 SPF 中发布了主机 A。只需将其他人添加到允许的发件人列表中即可:
C.
This is nothing to do with PHP.
No you can't spoof addresses in the way you suggest - but the reason that emails are being classified as spam is because you've only got Host A published in your SPF. Just add the others to the permitted senders list:
C.
您没有提供有关服务器设置的任何详细信息,因此无法真正回答这个问题。不过,PHP 可以使用您喜欢的 SMTP 服务器。最简单的设置方法是像 PHPMailer 这样的工具。
如果您无法更改发送的 IP,则需要更改域 B 的 MX 记录 使域 A(或其 IP)成为该域的邮件服务器。我很确定像 Google 邮件这样的垃圾邮件过滤器只查找 MX 记录。当然,您必须在域 A 上同时拥有电子邮件发送和接收设施才能实现此功能。
You're not giving any details about your server setup so this can't really be answered. PHP can, however, use a SMTP server of your liking. The easiest way to set this up is a tool like PHPMailer.
If you can't change the IP you're sending from, you need to change domain B's MX record making Domain A (or its IP) the mail server for that domain. I'm pretty sure spam filters like Google mail look for the MX record only. Of course, you would have to have both E-Mail sending and receiving facilities on Domain A for this to work.
PHP 通常设置为将邮件投递到本地主机 MTA,本地主机 MTA 将始终从其自己的绑定 IP 地址发送邮件。所以,不。
要减少因邮件来自与域的 DNS 记录(MX 或后备 A)不相关的地址而被标记为垃圾邮件的可能性,请添加 SPF 记录到所有域的 DNS,表明来自发送 IP 地址的邮件没有问题。
PHP is usually set up to drop mail onto the localhost MTA, which will always send it on from its own bound IP address. So, no.
To reduce the chances of being marked as spam because your mail comes from an address that doesn't tie up with the DNS records (MX or fallback A) for a domain, add an SPF record to the DNS for all the domains saying that mail from the sending IP address is fine.