I've started to use the mail function in php quite heavily in my latest scripts, however all of my emails sent from my site end up in the spam box. Is there any way i can attempt to prevent my mail being marked as spam? In case you're wondering, it's being used in the registration part of the script in order to authorise a registration attempt
Make sure the sending box has it's rDNS set correctly. That's usually the main issue. Without knowing the url of the site, the IP address of where the email is coming from or at least seeing the headers of the mail message in question, it;s hard to tell what's occurring. (That's a hint by the way.)
Make sure you're not blacklisted. Also, try to make your email more personal to the user. It sometimes works with some recipients.
you can use any spam checker tool to see if the message you are sending has content that can be treated as spam.
The url of the site is currently varying as i keep changing where i'm testing it domain wise, but it's based on the same server. The IP of the website is 213.229.86.50 currently, and the headers are: $emailheaders = 'From: '.$adminemail.' ' . "\r\n" . 'Reply-To: '.$adminemail.' ' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); I'm pretty new to the use of the mail function, so all help is greatly appreciated.
Has rDNS (Hydra.3v0.net) so that's fine. If you have access, you need to lowercase the 'H' as it;s not correct. I wouldn't call that a reason to block though. Those aren;t headers though. That's the code that makes them. If that's what's coming out in the emails though, that's a problem. Do you have a sample email that you can copy and paste from? Reference: http://uic.edu/depts/accc/newsletter/adn29/legitmail.html Some of that is added (or should be added) by the mailer. Take a look at how wpmu does theirs: http://trac.mu.wordpress.org/browser/trunk/wp-includes/wpmu-functions.php#L1595 Looks like mime and content type is missing at the very least. Hope this helps, -drmike
A lot of good solutions have been posted already. Check all the solutions above first... Then if you are still landing in the spam folder and don't know why, try using a few accounts and marking it as "not spam". Sometimes the spam filter default is to assume you are spam if you have no reputation.