You can prevent emails sent in PHP from going to spam by using a correct source code
and using a correct content in email
. But there are also some other factors, having impact on spam recognition
. Email providers are using a different spam filters, based on different rule. Because of that, your email can be delivered to inbox in case of some email providers, but the same email can be marked as a spam by other email providers.How to prevent emails from going to the spam folder:
- Make sure all parameters in email() function are correctly filled (To, Subject, Message, Headers). Check if you are using headers in a correct way. You can use different content types or character sets.
- Don't use too many links, images, attachments in email's content Avoid using links to untrusted websites..
- Don't use words that trigger spam filters (words that can make email look like a spam). Avoid using of these words in subject and message.
- Don't use many words in ALL CAPS, don't use too many exclamation marks or currency signs.
- Make emails visually not like a spam, so recipients open and read them without deleting them or marking as a spam (it is bad if recipients delete email or mark it as a spam, but it is even worse if they do so without opening it).
- Don't send too many emails with the same content (if possible don't do it at the same time).
- Check if email address from which you are sending emails, is not flagged as spam.
- Check if IP address from which you are sending emails, is not flagged as spam.