php mail()转到垃圾邮件但是通过SMTP服务器发送它可以正常工作吗?

时间:2021-06-26 18:14:55

I am currently setting up my webserver so then i can send emails via PHP Code, the problem i have is that the emails sent via php mail() always send to my gmail spam where as when im sending emails via the SMTP Server the same VPS has on it on Gmail it dont send to spam.

我目前正在设置我的网络服务器,所以我可以通过PHP代码发送电子邮件,我的问题是通过php mail()发送的电子邮件总是发送到我的gmail垃圾邮件,当我通过SMTP服务器发送电子邮件时相同的VPS在Gmail上它没有发送到垃圾邮件。

Is their anyone that can help with this?

他们的任何人可以帮忙吗?

Updates:

Sending Via Ryan@Ryanteck.org.uk & Noreply@Mc-Serverlist.co.uk For PHP Mail() (Same happens with ryan@ryanteck.org.uk)

发送电子邮件通过Ryan@Ryanteck.org.uk和Noreply@Mc-Serverlist.co.uk获取PHP邮件()(与ryan@ryanteck.org.uk相同)

When Sent Via PHP Mail() Or Webmin Email It Sends To Spam

当通过PHP邮件()或Webmin电子邮件发送它发送到垃圾邮件

When Sent Via SMTP Server Via Gmail it sends ok

通过SMTP通过SMTP服务器发送时,它发送正常

PHP Mail Raw Message : http://pastebin.com/TP2UfDP7 (This is the Noreply@Mc-Serverlist.co.uk)

PHP邮件原始消息:http://pastebin.com/TP2UfDP7(这是Noreply@Mc-Serverlist.co.uk)

Webmin Email System : http://pastebin.com/2VWvDd7v

Webmin电子邮件系统:http://pastebin.com/2VWvDd7v

Gmail SMTP : http://pastebin.com/wgewGnmk

Gmail SMTP:http://pastebin.com/wgewGnmk

3 个解决方案

#1


2  

Your vps doesn't have rDNS configured and the HELO points to a different ip. inconsistencies in HELO and missing rDNS trigger many spamfilters.

您的vps没有配置rDNS,并且HELO指向不同的IP。 HELO中的不一致和丢失的rDNS会触发许多垃圾邮件过滤器。

Received: from ryanteck.org.uk ([95.154.250.75])

收到:来自ryanteck.org.uk([95.154.250.75])

Host 75.250.154.95.in-addr.arpa. not found: 3(NXDOMAIN)

主持人75.250.154.95.in-addr.arpa。未找到:3(NXDOMAIN)

ryanteck.org.uk has address 95.154.250.165

ryanteck.org.uk的地址是95.154.250.165

Set a HELO Hostname whose A-Record points back to your VPS and configure the rDNS (PTR) to the same hostname.

设置一个HELO主机名,其A-Record指向您的VPS,并将rDNS(PTR)配置为相同的主机名。

Example:

  • Create a new A-Record 'vps.ryanteck.org.uk 95.154.250.75'
  • 创建一个新的A-Record'vps.ryanteck.org.uk 95.154.250.75'

  • Set the HELO to 'vps.ryanteck.org.uk'
  • 将HELO设置为'vps.ryanteck.org.uk'

  • Set the reverse DNS (PTR) for 75.250.154.95 to vps.ryanteck.org.uk
  • 将75.250.154.95的反向DNS(PTR)设置为vps.ryanteck.org.uk

Also your senderdomains have somewhat strange "TXT" records:

你的发送者域名也有一些奇怪的“TXT”记录:

dig txt mc-serverlist.co.uk +short 
"95.154.250.165"
dig txt ryanteck.org.uk +short
"95.154.250.165"

you may want to change these into correctly formatted SPF records, eg.

您可能希望将这些更改为格式正确的SPF记录,例如。

v=spf1 ip4:95.154.250.165 ip4:95.154.250.75 ~all

#2


1  

Try this:

mail('my@gmail.com', 'my subject', 'my text', 'From: noreply@myweb.com', '-f noreply@myweb.com');

#3


1  

Set the -f noreply@myweb.com parameter, as described in PHP ref

设置-f noreply@myweb.com参数,如PHP参考资料中所述

For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

例如,当使用带有-f sendmail选项的sendmail时,可以使用此选项设置信封发件人地址。

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

Web服务器运行的用户应作为受信任用户添加到sendmail配置中,以防止在使用此方法设置信封发件人(-f)时将“X-Warning”标头添加到邮件中。对于sendmail用户,此文件是/ etc / mail / trusted-users。

#1


2  

Your vps doesn't have rDNS configured and the HELO points to a different ip. inconsistencies in HELO and missing rDNS trigger many spamfilters.

您的vps没有配置rDNS,并且HELO指向不同的IP。 HELO中的不一致和丢失的rDNS会触发许多垃圾邮件过滤器。

Received: from ryanteck.org.uk ([95.154.250.75])

收到:来自ryanteck.org.uk([95.154.250.75])

Host 75.250.154.95.in-addr.arpa. not found: 3(NXDOMAIN)

主持人75.250.154.95.in-addr.arpa。未找到:3(NXDOMAIN)

ryanteck.org.uk has address 95.154.250.165

ryanteck.org.uk的地址是95.154.250.165

Set a HELO Hostname whose A-Record points back to your VPS and configure the rDNS (PTR) to the same hostname.

设置一个HELO主机名,其A-Record指向您的VPS,并将rDNS(PTR)配置为相同的主机名。

Example:

  • Create a new A-Record 'vps.ryanteck.org.uk 95.154.250.75'
  • 创建一个新的A-Record'vps.ryanteck.org.uk 95.154.250.75'

  • Set the HELO to 'vps.ryanteck.org.uk'
  • 将HELO设置为'vps.ryanteck.org.uk'

  • Set the reverse DNS (PTR) for 75.250.154.95 to vps.ryanteck.org.uk
  • 将75.250.154.95的反向DNS(PTR)设置为vps.ryanteck.org.uk

Also your senderdomains have somewhat strange "TXT" records:

你的发送者域名也有一些奇怪的“TXT”记录:

dig txt mc-serverlist.co.uk +short 
"95.154.250.165"
dig txt ryanteck.org.uk +short
"95.154.250.165"

you may want to change these into correctly formatted SPF records, eg.

您可能希望将这些更改为格式正确的SPF记录,例如。

v=spf1 ip4:95.154.250.165 ip4:95.154.250.75 ~all

#2


1  

Try this:

mail('my@gmail.com', 'my subject', 'my text', 'From: noreply@myweb.com', '-f noreply@myweb.com');

#3


1  

Set the -f noreply@myweb.com parameter, as described in PHP ref

设置-f noreply@myweb.com参数,如PHP参考资料中所述

For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

例如,当使用带有-f sendmail选项的sendmail时,可以使用此选项设置信封发件人地址。

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

Web服务器运行的用户应作为受信任用户添加到sendmail配置中,以防止在使用此方法设置信封发件人(-f)时将“X-Warning”标头添加到邮件中。对于sendmail用户,此文件是/ etc / mail / trusted-users。