"Spam with Cheese", ©kris247

If you’re using PHP you want PHPMailer. If you’re using something else there’s probably an equivalent library (Google is your friend). However, regardless of how you do it you should always consider the impact of your email activities on your users. Unwanted email is one of the biggest problems on the Internet today and the more you can do to present your website as a responsible sender of email the better.


There are essentially two types of email that you might send out to the users of your website: operational and non-operational. The purpose and content of the two differ greatly and it’s important to understand the purpose of each to ensure your users understand why they’re getting them and what action (if any) they need to take when they do.

Operational Emails

The term operational emails refers to emails that directly relate to the service you are providing the user. For example this would include welcome messages, order acknowledgements and reminders that you may send to users in response to their actions or other events.

Successful operational emails are the ones that keep it simple. You’re sending them because they provide value for the user, so avoid the temptation to load them up with marketing information.

Sales & Marketing Emails

Promotional emails can be a very effective way of reminding your users that you’re there. I’m sure I have accounts on many websites I never visit and that haven’t even crossed my mind lately, but it’s likely if I received an occasional email from them I’d go visit them. I may just go back to delete my account, but surely that’s better than account rot. On the other hand it may remind me why I signed up in the first place and I could become an active user again.

Emails can also be a great medium through which to inform your users of new features on your site, or long-standing features that aren’t getting used. And don’t forget that they also provide the opportunity to push the features of your site that make you money.

Evil reasons aside (because we all know sales and marketing people are an evil bunch), regular contact with your users is more likely to engage them with your website. Nothing you do on the site itself can have the same effect, but you have to do it right to prevent getting bitten by consequences.

The keys to success with sales and marketing emails differ greatly depending on the subject and audience.


More important (from a potential problems point of view) than the content of the emails you send is the process and procedures you use to actually send them. Most of this should sound like common sense but I think it’s important to state the obvious. The public view of commercial email, whether unsolicited or not is well-known, so unless you want to give your website a bad reputation you need to take care to do it properly.

Recipient management

Track your recipient list carefully. If someone tells you they don’t want your email, don’t send them email. There is no commercial value in sending email to someone who doesn’t want it, but the potential damage it can cause is extensive.


You’ll already know that you need to provide unsubscribe instructions in each email you send. For operational emails it may be as simple as “you have an account and to use it you need to get these emails”. For promotional emails you need to provide a way for people to unsubscribe from them but continue to receive operational emails.

When someone does unsubscribe, honour it. In my opinion it’s a good idea to keep a separate list of addresses that have unsubscribed as well as noting it against the user on your website. Whenever you send an email you should check to see if the recipient is in that separate unsubscribed list first.


Track these too. Email can bounce for a variety of reasons. It could be that the address really doesn’t exist, or it could be because the mailbox is full. Either way you need to have a procedure in place to deal with addresses that bounce.

Given that not all bounces mean the address is not valid it’s a good idea to have a bounce threshold. Record bounces and when you get more than 1 (or more than 2 if you want to be more tolerant) for a given address mark them as bounced and stop sending email to it. This will prevent your mail server from having to do more work than it needs to.

I’ve heard several people suggest that it’s a good idea to periodically flush bounced addresses. The argument centres around the possibility that you might mark perfectly valid addresses as bounced in fairly rare circumstances. The idea is that you unmark bounced addresses after some random period of time, thereby getting back any that were incorrectly marked as bounced. Personally I don’t think it’s worth it, but if your bounce rate is low it can’t hurt. Just be sure not to apply the same logic to unsubscribed addresses!

Email structure

Well-behaved emails are those that have proper well-formed headers. The following list highlights the really important ones…

blog comments powered by Disqus