php mail()转到垃圾邮件,但是当通过SMTP服务器发送时它工作正常吗? [关闭]

php mail()转到垃圾邮件,但是当通过SMTP服务器发送时它工作正常吗?  [关闭]

问题描述:

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.

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)

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

When Sent Via SMTP Server Via Gmail it sends ok

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

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

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

我正在设置我的网络服务器,以便我可以通过PHP代码发送电子邮件,我的问题是, 通过php mail()发送的电子邮件总是发送到我的垃圾邮件,当我通过SMTP服务器发送电子邮件时,Gmail上的电子邮件与Gmail上的电子邮件相同,它不会发送到垃圾邮件。 p>

他们是 有谁可以提供帮助吗? p>

更新: h2>

发送电子邮件:Ryan@Ryanteck.org.uk& Noreply@Mc-Serverlist.co.uk对于PHP Mail()(与ryan@ryanteck.org.uk相同) p>

通过PHP Mail()或Webmin发送的电子邮件发送至 垃圾邮件 p>

通过SMTP服务器发送时通过Gmail发送确认 p>

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

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

Gmail SMTP: http://pastebin.com/wgewGnmk p> div>

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

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

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

ryanteck.org.uk has address 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.

Example:

  • Create a new A-Record 'vps.ryanteck.org.uk 95.154.250.75'
  • Set the HELO to 'vps.ryanteck.org.uk'
  • Set the reverse DNS (PTR) for 75.250.154.95 to vps.ryanteck.org.uk

Also your senderdomains have somewhat strange "TXT" records:

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.

v=spf1 ip4:95.154.250.165 ip4:95.154.250.75 ~all

Try this:

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

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

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

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.