Published by Mijingo

movie icon image

ExpressionEngine How-to Articles

Topics range from beginner to advanced, but are all born out of real world, professional, day-to-day use of ExpressionEngine. Need more information? Get training videos and ebooks on ExpressionEngine from Mijingo.

How to Connect ExpressionEngine to a Third Party Email Delivery Service

Has a client ever said to you, “Why didn’t I get that reset password email?” Have you ever had to wait patiently for like ten minutes to get a new member activation email? Ever lose sleep wondering if your contact form is really working? If so, let me introduce you to the wonderful world of transactional email delivery services.

What is transactional email?

Think of transactional email as any message sent to an individual based on some action they took. In the ExpressionEngine world that includes:

  • New member activation instructions
  • Forgotten password instructions
  • Admin notification of new comments, forum posts, entries or members
  • Private message notifications
  • User comment notifications
  • Tell-A-Friend notifications
  • Email generated from certain add-ons like Freeform, Postmaster or CartThrob.

Keep in mind that we’re not talking about email marketing, newsletters or any email that is sent in bulk. There are other services for that.

Why would I want to use a 3rd party service?

An email service gives you better logging and insight when it’s time to troubleshoot delivery issues. Did the system fail to send the email or did the message get caught in the recipient’s spam folder? That can be hard to determine without writing custom logging code.

If you’re using an email service, just log into their control panel and you’ll know right away if ExpressionEngine sent the email or not. Then you’ll know where to start troubleshooting.

Email Log Postmark’s outbound email report

Email delivery can be tricky business. It’s part art and part science and if you don’t know what you’re doing, it’s all painful. There are blacklists to monitor, feedback loops to process, IP addresses to warm up, logs to monitor, errors to handle, opens to track and reports to generate.

If it sounds like a lot of work, it is.

Luckily for us, there are crazy people in the world who really enjoy managing email servers and they’ll send your transactional email for fractions of a penny per message.

Comparing 3rd party email services

There are a handful of reputable companies that provide transactional email delivery services. Here are a few to consider.

  • Amazon Simple Email Service (aka Amazon SES) is part of the cloud computing platform provided by the world’s largest online retailer.

  • Mailgun started as a Y Combinator company and was acquired by Rackspace in August 2012.

  • Mandrill is a relative newcomer. The service launched in April 2012, but was built by the folks at MailChimp, who know a thing or two about email.

  • Postmark is brought to you by the team at Wildbit, who you may also know as the makers of Beanstalk.

  • SendGrid was started in 2009 from the TechStars program. Transactional email and high-volume enterprise email is their specialty.

All of these services offer the same basic features like simple SMTP integration, full-featured APIs, reporting and a free pricing tier for lower volumes. This makes them all good candidates for integrating with your ExpressionEngine site.

Email delivery is a commodity service, so pricing is important. Let’s compare.

Service Free Tier Pricing Structure
Amazon SES 2,000 messages per day if you’re an EC2 customer (data transfer fees apply) $0.10 per thousand messages plus data transfer fees
Mailgun 200 messages per day Tiered pricing with monthly minimums ranging from $19 to $199 per month
Mandrill 400 messages per day* Tiered pricing based on volume with no minimums
Postmark 1,000 free messages Flat $1.50 per thousand messages
SendGrid 200 messages per day Flat monthly fees from $9.95 to $399.95 per month based on usage. Pay as you go option of $0.10 per 1,000 emails

*Mandrill’s free tier is 12,000 messages per month. We divided by 30 for an easier comparison with the other free plans that are based on daily usage.

As you can see, each service takes a slightly different approach to pricing which makes for difficult apples-to-apples comparisons. Here are a few scenarios to save you some time and arithmetic.

Service 200 per day 6,000 per month 500 per day 15,000 per month 1000 per day 30,000 per month 2000 per day 60,000 per month
Amazon SES $0.60 / month $1 / month $3 / month $6 / month
Mailgun Free $19 / month $30 / month $59 / month
Mandrill Free $9.95 / month $9.95 / month $27.95 / month
Postmark $9 / month $22.50 / month $45 / month $90 / month
SendGrid* Free $1.50 / month $3 / month $6 / month

*SendGrid pricing based on their pay-as-you-go Lite plan.

Unsurprisingly, Amazon is a low cost leader, but their control panel and setup process is a little more technical than the others. SendGrid’s pay-as-you-go plan is also very competitive. Mandrill has the most generous free tier at 12,000 messages per month. However, none of these plans will break the bank assuming a low to moderate message volume.

There’s really no reason not to use one of these services. So, let’s set one up.

How do I configure EE?

Sure, you could write custom code that uses an API to send your messages. But, all of these services have a secret weapon that makes them very simple to integrate with ExpressionEngine; Simple Mail Transfer Protocol (aka SMTP).

SMTP is a standard internet protocol for delivering email that was established back in the 80’s. ExpressionEngine supports SMTP out of the box. How great is that?

Before we get too far you’ll want to make sure that your web host supports SMTP, but most do. For a quick check, go to Tools > Utilities > PHP Info and search for SMTP. If you see SMTP configured in PHP there’s a good chance your host is set up for it.

Now, configure ExpressionEngine. Don’t be scared. It’s easy.

  1. In the control panel, go to Admin > Email Configuration
  2. Change Email Protocol to SMTP
  3. Enter your service’s SMTP Server Address, Username and Password as they specify
  4. Submit and save your settings

Email Configuration There is no step #5!

Now, ExpressionEngine should be configured to send all of its email through the 3rd party service. To test it go to Tools > Communicate and try sending an email to yourself. You should receive the email right away and see the email in your email service’s reporting dashboard.

If not, go to Admin > Email Configuration and set Enable Email Debugging to Yes and give it another shot. Then go to Tools > Logs > Email Console Log and look for anything suspicious.

Is it working? Great!

Rest easy knowing that a whole team of people are working behind the scenes to make sure your email is delivered.

Posted on Feb 26, 2013

Filed Under: How-To,

Jason Siffring
About Jason Siffring

Jason started his career at Procter & Gamble, survived the first dot com bubble at a startup in Silicon Valley and provided IT consulting to Fortune 500 companies for ten years at Loudcloud, EDS and VMware. He owns Surprise Highway, a web development studio in Chicago that specializes in ExpressionEngine and custom PHP development and co-hosts the Chicago EE user group. Follow him on Twitter @siffring.