Attending to the SendGrid’s Email Delivery Hands-On – Part 1

Hi! I’m Dennis and I’ve been working at Linkbal as a software engineer since October 2017.

Today, I’d like to share how was my experience taking part in SendGrid’s mail delivery hands-on. I will mainly write about some background information and concepts that were presented and also about the first part of the hands-on, that included the initial setup, a simple email delivery test and the use of SendGrid’s dashboard to check the results.

目次

Introduction

SendGrid is an US based company represented by KOZO KEIKAKU ENGINEERING Inc. here in Japan.

As you may already know, it provides one of the most well-known cloud-based transactional email delivery services, but also includes an email marketing platform. This article will focus on transactional emails as it was also the focus of the hands-on.

Background Information

The hands-on started with the presentation of some background information about SendGrid and the company representing it in Japan.

Then, the presenter  showed how their service is used daily by large corporations to send transactional emails, such as sign-up notifications, password resets and invoices. And also how their tool is used to send marketing emails such as promotions, campaigns and newsletters.

After that, the subject was the challenges involved in email delivery as, according to ReturnPath, 20% of the emails don’t reach the inbox. Then, all the things we need to consider when working with emails were presented.

Mail delivery flow

Source: https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/email_flow.html

Reputation

And, when working with emails, one of the most important things to consider is our sending reputation. This is a score that an Internet Service Provider (ISP) attributes to mail senders and it is a very important factor in email deliverability. The higher our reputation with a ISP, the more likely it will deliver our emails to the inboxes of recipients in its network. Low reputation, by contrast, may result in emails being recognized as spam or even discarded.

Each ISP decides which factors to consider when calculating this metric, but there are factors that are commonly used such as the reputation senders build around their IP and domain. You can read more about those types of reputation here.

After the explanation about reputation, the presenter showed us some practices that can be applied to increase our score. I won’t enter in much detail here and will briefly mention just two examples below. You can read more about these and other methods to increase email deliverability are mentioned in this article.

  • List Cleaning – the act of removing addresses that are inactive, reporting your emails as spam or leading to bounces. Keep trying to send emails to such addresses can eventually impact your reputation negatively.
  • IP Warm-Up – especially when start using a specific IP address, it is recommended to increase the amount of emails sent little by little. This will help ISPs recognize that you are sending wanted email.

The Hands-On

After the introduction above, we effectively started the hands-on, which was focused on using SendGrid’s Web API and interacting with its dashboard. In this article, I will only present the first part of the hands-on, containing information about a simple email delivery. The requirements for the hands-on were the following:

After logging in to the application, we are presented to the following screen:

Preparation

There are a couple of initial steps we will want to take before actually testing the Web API.

First, let’s enable plain text emails. By default, SendGrid automatically converts any plain text messages to multipart emails. As this is usually a unnecessary feature, let’s disable it.

Go go Settings > Mail Settings and under “Plain Content”, switch it to “ON”.

Plain content setting

Next, we are going to create a new API key. It will be used for authentication and authorization when using the API. Just go to Settings > API Keys and click the “Create API Key” button. Give it any name you want and choose the “Restricted Access” option, so we can customize the access level for the key. For each feature, we can choose one of: “No Access”, “Read Access” and “Full Access”. Read access allow us to just execute GET requests against that specific feature.

For the hands-on, we set “Mail Send” to “Full Access” and “Suppressions” to “Read Access”.

API access levels

Click “Create & View” and you will be presented to your newly created key.  You have to store it somewhere safe as it won’t be shown again.

Calling the API

After the initial setup steps, we started testing the API. It is nice that all the tests can be done in the API’s reference page:

https://sendgrid.com/docs/API_Reference/api_v3.html

In the side menu, select “MAIL SEND”. After the page opens, click the “Try it out” tab and paste your API key in the “YOUR_API_KEY” field.

Mail Send API reference

At this point, we can already start making calls to the SendGrid’s API. Just edit the “Request Body” to look like below (replace the recipient_email_address and recipient_name accordingly).

Then, click “SEND REQUEST” and the “Response” field should change to “202 Accepted”. Also, check your inbox as you should have received the test message.

The Activity Feed

We can use the dashboard to keep track of the sent emails. Just access the “Activity” menu in the sidebar. Click “Search” to list the sent emails and our test email should show up. If everything went fine, the email should show “Delivered” in the STATUS column. You can also click the message to display additional details.

During its life-cycle, our test email should have gone through the “Processed” and “Delivered” events. In the diagram below, you can check all the events a message can go through.

Email event flow

Source: https://sendgrid.com/docs/API_Reference/Event_Webhook/event.html

Conclusion

In this article, I shared some of the concepts presented in the SendGrid’s event and the first part of the contents of the hands-on. There are still some content to be covered in a future post, such as “Bounce Handling”, “The Tracking Feature” and “The Use of Templates”.