简体   繁体   English

从具有不同IP的专用服务器发送的电子邮件

[英]Email to be sent out from a dedicated server with different IP

We have three domains hosted on one dedicated server each with its own dedicated IP. 我们在一个专用服务器上托管了三个域,每个服务器都有自己的专用IP。

Domain A - Has the server primary IP address (default server IP) 域A - 具有服务器主IP地址(默认服务器IP)
Domain B - Has its own IP address 域B - 拥有自己的IP地址
Domain C - has its own IP address 域C - 有自己的IP地址

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. 如果一封电子邮件从域B发出,那么它在传出中使用域A IP地址,这使得使用PHP从域B发送的电子邮件直接转到垃圾邮件箱等。

Is there any way to change the source IP depending on where the email originates from in PHP? 有没有办法根据PHP中的电子邮件来源更改源IP? What should we change to fix this? 我们应该改变什么来解决这个问题?

This is nothing to do with PHP. 这与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. 不,你不能以你建议的方式欺骗​​地址 - 但是电子邮件被归类为垃圾邮件的原因是因为你只在你的SPF中发布了主机A. Just add the others to the permitted senders list: 只需将其他人添加到允许的发件人列表中:

"v=spf1 a:hostA.example.com a:hostB.example.com a:hostC.example.com"

C. C。

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. 但是,PHP可以使用您喜欢的SMTP服务器。 The easiest way to set this up is a tool like PHPMailer . 设置它的最简单方法是像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. 如果您无法更改发送的IP,则需要更改域B的MX记录,使域A(或其IP)成为该域的邮件服务器。 I'm pretty sure spam filters like Google mail look for the MX record only. 我很确定像Google邮件这样的垃圾邮件过滤器只会查找MX记录。 Of course, you would have to have both E-Mail sending and receiving facilities on Domain A for this to work. 当然,您必须在域A上同时拥有电子邮件发送和接收设施才能使用。

PHP is usually set up to drop mail onto the localhost MTA, which will always send it on from its own bound IP address. PHP通常设置为将邮件丢弃到localhost MTA,后者将始终从自己的绑定IP地址发送邮件。 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. 为了减少被标记为垃圾邮件的可能性,因为您的邮件来自不与域的DNS记录(MX或后备A)相关联的地址,请为DNS添加SPF记录以用于说明该邮件的所有域从发送IP地址是好的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM