Reputation:
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 :)
Upvotes: 1
Views: 1994
Reputation: 2282
For anyone searching, try reading codinghorror's summary on making sure, in the most possible way, that emails are not flagged as spam.
http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html
Upvotes: 0
Reputation: 1944
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('[email protected]', 'Subject', 'Body text...',
'From: [email protected]');
That should get you past almost all spam filters -- assuming you're not actually sending out spammy content! :)
Upvotes: 2