Must follow rules when sending emails with php and smtp to avoid beeing marked as spam or getting filtered [closed]

StackOverflow https://stackoverflow.com/questions/14748801

Question

I am writing a PHP script with login system which sends activation emails once the registration process has successfully accomplished, however I've noticed that for some email providers my emails notifications goes straight into spam folder or filtered by smartscreen (hotmail) and for some don't even get delivered in spam folders.

I am using this class to send my emails:

http://forums.eukhost.com/f15/php-class-send-mail-via-smtp-auth-14644/

I don't have special requirements such attachments, but I want to know if something is missing what I can do to avoid email filters.

Do the headers need to contain extra informations?

The message size should not be under certain size?

Any other rule to follow?

I don't really send spam to anyone, just activation emails and notifications.

Was it helpful?

Solution

To get my web app's emails through the Gmail spam filter, I had to:

1) Set up DKIM on mail server and sign all outgoing emails
2) Set up SPF records
3) Make sure emails are multipart (contain both HTML and plaintext), not just HTML
4) Make sure HTML email is formatted correctly (html open and close tags, etc.).
5) Ensure mail server's reverse DNS is set up properly

It was a long night for me getting all of that crud set up. But, these steps appeared to earn me enough "maybe-not-spam" points to get through. There are also third-party email hosts you can use that specialize in making sure web-app related email gets delivered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top