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
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.
来源:https://stackoverflow.com/questions/8525724/php-mail-goes-to-spam-but-when-sent-via-smtp-server-it-works-fine