Q:

PHP Sending Automated Mail That Doesn't Goto The SPAM Folder? 

I've always been a little troubled when it comes to sending mail through PHP functions. 
But it hasn't really been a problem until my latest project. 
I'm looking for the absolute best way of sending mail through PHP and not having it end up in the SPAM folder :/
I'm aware that it won't probably work 100% of the time,
I'm just looking for the best option. 
Thanks :)

A:

The number one reason mail usually ends up in the SPAM folder (when the content isn't actually spammy) is that the From: header isn't set or is set to a non-existant email address.  If the header is empty the message will appear to come from something like webmaster@localdomain. 
In the mail() call (refer to the docs) be sure to populate the $additional_headers field like:
mail('to@example.com', 'Subject', 'Body text...', 
             'From: me@realaddress.com');

That should get you past almost all spam filters -- assuming you're not actually sending out spammy content! :)