3

I want to send an HTML email with PHP. I was wondering what headers should be used in the email to ensure it doesn't get blocked or end up in SPAM folders.

The email contents will contain CSS and HTML. The reply-to field will be different than the sender's ( will this affect anything? )

EDIT: I don't know why my question was voted down. Anyway, I'm not looking to email SPAM or mailing lists. The reason why I want the reply-to field to be different than the sender is because I'm creating a web app where a user manages jobs from various clients. Whenever a job is updated or created, the app will automatically send an email regarding job updates to the client. The client can then reply to the email to contact the user - that's why I need the reply-to field to be the user's email address.

  • 1
    look at the list of related questions on the right, and nothing will 100% guarantee delivery. –  Feb 29 '12 at 18:57
  • 1
    in addition to what @Dagon said: HTML formatted emails usually end up in the SPAM folder. If you want to minimize getting detected as spam - use text version and add a link that will display the HTML content. and us to your second question - yes, a different "reply-to" field is also detected as SPAM or even worse, fishing... – Nir Alfasi Feb 29 '12 at 19:00
  • I didn't include this in my answer as it was not explicitly asked but it will save you some headaches. When designing your emails make sure you use CSS at a tag level whenever possible. Although this is bad for web design it's crucial for html email design to avoid your css being overridden by whatever style sheets are in place on the web page viewing the email. Also ALWAYS include a plaintext version of the email! Double check your formatting by sending to several email providers (yahoo, gmail and an outlook client for example) – Liath Feb 29 '12 at 19:13

3 Answers3

4

There are many different factors which take into account whether an email is blocked or not, headers play a part but also to consider are:

  • Consistent number of emails being sent day to day (100,000 once a month will damage your reputation more than 100,000 each day)
  • If you frequently email to bouncing addresses
  • Whether you are on the recipient's safe sender's list
  • The email provider you are sending to
  • Various DNS settings such as are you sending email from the domain your IP is registered to
  • Whether you frequently email invalid addresses
  • Whether you have been blacklisted by one of the blacklist companies
  • Various other email provider mechanism such as yahoo's domain key
  • The content of the email, avoid phrases like FREE, MONEY and LUCKY
  • Whether you include an unsubscribe link ( you MUST MUST provide an easy way to opt out of emails)

For one off emails you are often ok, if you plan to use your application to send frequent mailing lists it may be worth enlisting a third party company specialising in bulk email.

Liath
  • 9,913
  • 9
  • 51
  • 81
2

Think about using a email sending service whose SLA (service Level Agreement) aligns with the deliverability rate you require.

There are a bunch of services that do this: SendGrid, Amazon SES, etc.

I suggest SendGrid because its relatively cheap and extremely easy to implement.

Also, this was an interesting read (not scholarly, but has some interesting insights): http://www.smashingmagazine.com/2007/10/16/best-practices-for-bulletproof-e-mail-delivery/

Francis Yaconiello
  • 10,829
  • 2
  • 35
  • 54
0

Differing sender and reply-to fields can be a red flag for some spam filters (although not all), but the best approach to ensure delivery is to do everything by the book. Spam is often identified by the fact that it is similar to other spam, has some parts of the header differing from standard as you identified, or is sent from a server not authorised for that email domain (see sender policy frameworks for a good way to improve your chances and ask your hosting provider to set it up).

Matt Gibson
  • 14,616
  • 7
  • 47
  • 79