Essential email send tips for PHP developers

Have you ever built a website that fires emails (perhaps important confirmation emails) but the emails either:

* Take ages to send


* Don’t send at all

It’s a drag and it’s a problem that has plagued me for ages.  PHP and emails generally don’t get along, in my opinion.  Emails fired from PHP scripts are generally not reliable.

So, let me tell you everything you need to know about firing emails using PHP and then I’ll wrap up with some recommendations for you.  Ooh yeah!


If you’re on a shared server (most developers are) then your web hosting package almost certainly won’t be optimised for firing emails.  A lot of hosting companies limit you to 50 emails per day and – get this – if you go over the limit then they don’t even tell you.  The swines!  I’ve had one client in the past who (before hiring me) thought he was sending mail shots to thousands of his own prospects.  Little did he know that his host was cutting out all of his email sends after he reached his daily limit.  As you can imagine, he was totally depressed about how poorly his email marketing was doing.  Little did he know that most of his emails weren’t being sent.

Of course, daily send limits aren’t the only problems.  Most shared servers are prone to imposing random and annoying delays on your email sends.  So, it’s common to have an email ‘firing’ from PHP but not having it arrive for 30 minutes or more.  This is a complete deal breaker if you’re sending important confirmation emails that need to be checked and clicked immediately.

Finally, emails on shared servers usually freak out if they’re sending or receiving emails with large attachments.  In short, your web host probably isn’t up to the job of firing emails from PHP scripts.  It doesn’t really matter how good your code is – if you want a reliable way of firing emails then you’re gonna have to look for a more sophisticated solution.


Funnily enough, I don’t recommend spending a fortune on a dedicated server.  I think the times have moved on and there’s no longer any need to set up your own server.    Setting up dedicated servers is a drag and there’s lots of challenges with the whole vibe of your server getting blacklisted if a bunch of people submit complaints about your email campaigns.



If you do a bulk email send and get lots of complaints then your email sending server could get blocked by some ISPs.  That’s why the major email marketing providers are so paranoid about spam prevention.  HOWEVER, what most people don’t know is that the complaints process does not necessarily involve human interaction (phone calls, nagging letters, complaints depts, appeals etc).

If an email recipient simply adds a “this is spam” tag onto your one of your emails then – on most of the major email providers – that will automatically register as being an official ‘complaint’.  These complaints are then automatically fed back to your email service provider, if you use one.  It’s a heavy vibe and it’s one of the reasons why we have to be super careful never to do anything that might be seen as being spamming. 


You have three options for firing emails via your PHP code that I would consider to be sophisticated.  They are:

OPTION 1.  Fire your emails using a dedicated email marketing provider such as; Mailchimp, GetResponse, Aweber, MadMimi etc.

PROS: (1) Reliable email sends (not saying anything about deliverability or open rates mind you – those are different things), (2) lots of cool features available such as scheduled auto-responding and advanced reporting (fancy graphs – woohoo!)

CONS: (1) Can be difficult to set up, (2) the companies can sometimes act uncool (not allowing you to upload your list, uncompetitive behaviour, deleting subscribers etc),  (3) can be costly if you go above 2,000 subscribers on your list.

OPTION 2.  Fire your emails from Amazon (AWS) SES

Once again Amazon have shaken up the whole industry with their simple email send service!  It’s more cost effective that the first option, particularly for substantial bulk email sends.

PROS: (1). Reliable email sends, (2) costs less than option 1, (3) They generally leave you to get on with it and have a good system in place for steadily growing your lists (they call it “ramping” and it’s a good vibe).

CONS: (2). You’re responsible for managing your own lists which means that you’ll need to build your own sign up/unsubscribe functions.  So, you will be required to do some coding to build something that’s cool.

OPTION 3.  Fire your emails via Gmail

Yahtzee!  Free, reliable and they fire immediately.

PROS: (1) free, (2) fast as a bullet sends, (3) reliable email sends, (4) Gmail is very good at handling emails with large attachments.

CONS: (1) Not suitable for bulk email sends, (2) All of the emails that you send will come from a gmail (or googlemail) address.


For doing bulk email sends (sending emails to more than 10 people at a time) I think your best bet is to use either option 1 or 2.  Personally speaking, I prefer option 2.  I think it’s more cost effective and I don’t like the idea of having my list tethered to an email service provider.  In the recent past I’ve had some bad experiences with email service providers acting in an uncool fashion.  So, I’d rather just keep them out of the picture, if I can.  I think the Amazon option is brilliant and well worth looking into.

For firing occasional emails (such as ‘please confirm your subscription’) emails, I think your best bet is to just fire your emails via Gmail.  It’s free, it’s reliable and it can be set up quickly.  You’ll need to add a few additional lines of code to your PHP script to get it working (your Gmail login details etc) but the end result is that you’ll have a reliable, fast and free email sending facility for occasional email sends.

Here is a page with some details on how to fire emails on Gmail, using the CodeIgniter framework.


Any of the three options above will put you into ‘ninja’ category.  The whole vibe of moving away from using your rubbish hosting account to firing emails the way I’m suggesting is very professional.  The fact that you’ve read this far means that you’re a step ahead of most other developers.  You should pat yourself on the back for being so awesome!

Good luck!


One comment

  1. I’ve been using AWS SES for my latest client’s website. I’ve been amazed at how reliable it is and during all my tests, the emails have arrived within 2-3 seconds.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: