#6 Make sure those crucial emails get delivered with Craft CMS and SendGrid

The Problem

Sending email via phpmail can be troublesome, luckily there are 3rd party services out there that specialise in doing exactly what you want - get your email delivered successfully. Their core offering is delivering email, and these services are very reliable.

This video is very much a follow up to the Mandrill video i did last year in 2015. Unfortunately, since then, MailChimp has made the previously free service a paid service. The plans start at $20 a month, which isn’t a massive amount of money, but amounts like that add up.

A lot of people were up in arms about the change, but that’s part of a problem with pretty much anything third party in any industry. We have no control over what these services do, change or even if they continue to exist. Go native if you can, but be warned about any third party service.

In this instance going to a third party is the way to go. Only if you have vast experience with email, then can set up your own STMP or running phpmail be worth it. A service like SendGrid makes this potential problem, a non-problem... Just how we like it!

Solution

Sendmail has a free service of sending up to 12,000 emails per month. That’s a lot of emails and for the majority of sites should accommodate your email sending needs.

It’s very easy to set up and putting it through the settings in Craft CMS Developers Settings.

Testing locally

Luckily you can even use SendGrid locally (on your own local server). As you are not sending out email from your local server and you are just connecting to the SendGrid service, then from there SendGrid sends out your email. This is useful, sure you can test on staging, but it would not be a good idea to go straight to a production server without testing. Local testing here is important.

6 steps to Craft CMS and SendGrid success

  1. Go to SendGrid and sign up
  2. On the left-hand site Settings > API keys. Generate an API key but please take note of it. You cannot access that API key again. Not the end of the world as you can just generate another API key, but that would just be wasting time!
  3. Go to your Craft CMS admin area. Settings > Email
  4. Click the protocol select “SMTP”
    Host name: smtp.sendgrid.net
    Port: 587 or 465 for SSL
    Username: apikey
    Password: [your API key]
    SMTP Secure Transport Type: TLS
  5. Hit that “Test” button, with a bit of luck you will see a lovely email in your email service.
  6. Test, test! There is an iOS app, as well as an Android app. It would be good practice to look into SendGrid weekly to see if all is well.

Thanks for watching and please leave feedback.