[Case Study] How to Deliver Emails Without Getting Filtered to the Spam Folder?


A client approached us to add a feature to a site they were building. The site was to be an auctioning platform for football players. Among other enhancements, we worked on a registration confirmation feature. Many of the features in the site like registration, negotiation and other communications are based on an emailing system.

Problem Identification

The emails that were going out of the site were being marked spam and not being delivered to the intended recipient’s inbox. Another issue was that the number of emails sent daily got limited to 500 emails, Google’s email delivery limit.



Problem Research

When sending out emails through Gmail or via an email app, emails get routed through sender email service's SMTP service to the recipient’s SMTP email service. This is the normal way of sending emails, but even in this some emails were getting labeled as spam.

Nowadays, most email apps strictly scan emails to remove spam, and one of the main things they use to filter out spam messages is the IP address that is used to send the emails. They check against both blacklists as well as whitelists. If we are sending emails from a shared server, there's a possibility that our IP address is already on those blacklists.

If we have our own IP address, our mail still may get marked as spam, which means we are on a blacklist. If our site is not associated with a reputable or identifiable IP address and domain name, most email providers will mark it spam. We will also need an SPF or DMIK record, email validation tool that may be difficult to implement on our own but is included with most email sending services.

On consideration, we found that transactional email services were a good option in those cases.


Why we chose transactional email sending services?

Below are three situations (reasons) when transactional email services are the best options:

Sending more messages, faster

Gmail has a cap (capability) of 500 emails a day, a common limitation we face with email servers. Many shared hosting services also limit the number of emails that can be sent per day. With transactional email sending services, we can send from 10 emails a minute to even 10 million a month. Either way, the email service will be ready for our load, without any added effort from our side.

If we need to send thousands of emails a day through our app, or say deliver our company's newsletter to millions of people, we need to think a lot more about how our emails are to be sent. We need a transactional email service, a dedicated email sending service that'll make sure our emails are delivered no matter how many we send.

Ensuring your messages get delivered

Even if we choose our own servers, and have the infrastructure to send the messages we need, another potential problem we can face with owned email sending server is deliverability. We may technically be able to send emails on our own, but the probability of those emails showing up in our recipients' inboxes is close to nil.

Doing more with our emails

Some transactional email services, such as Amazon SES, are focused only on sending the email and thus priced accordingly. But most other transactional email services include advanced stats, notifications, filtering and other features which can’t be done using normal email services. With a bit of coding, or with just some clicks on the stats dashboard, we can do amazing things.




Depending on the ease of use, the stats dashboards, and other features we need we can select the right email sending service. The most simple and cheapest transactional email service is Amazon SES, it sends emails, and little else. Others like SendInBlue, Mandrill etc have features like SPF and IP address mapping, template hosting, reports, and analytics, etc, but they are often more expensive, even though your requirement might involve sending comparatively lesser number of emails. Depending on the features, one service may be better suited for our needs and by trying out the most suitable ones, we can see which works best with our apps and workflow and then standardize it.

Why SendGrid integration with SMTP module was chosen?

One of the biggest transactional email service providers is SendGrid. It delivers over 15 Billion emails each month for their clients. Some of their regular clients are Uber, Spotify, Airbnb and Glassdoor. SendGrid gives real-time analysis to optimize the performance of our email marketing campaign. With powerful segmentation and Contact Management tools we can simply send straightforward mail to a targeted and relevant audience.

SendGrid can handle massive email campaigns while providing highly detailed and flexible reporting, along with the ability to scale and increase deliverability, so we went with it.

Key features

  • Offers high email delivery to make sure our emails get delivered.
  • Allow us to analyze the results of the sent emails like number of opens, clicks, bounce, etc.
  • We can use Engagement Segmentation feature to group customers by how much they engage with messages.
  • We can also edit the transactional email templates either with the drag n drop editor, HTML or CSS.
  • We can build our own preview design and template with SendGrid to ensure that our emails are displayed beautifully and are well crafted.
  • We can open our Sendgrid account and other reports in the mobile phone.

Project Implementation

Create a SendGrid Account

After signing up for an account, we can select a plan that meets our business needs. After receiving a confirmation email, sign in to the SendGrid account. From within the Settings menu, click Credentials.


This is where we can create site-specific credentials so that sites have their own unique access to our SendGrid features and mail. Once we have created our site's credentials, we gain the desired access (UI/API and Mail).

Integrating Sendgrid With Drupal

Follow the procedure specified below for Drupal CMS. There are two methods that can be used to integrate SendGrid with a Drupal 8 site: API or SMTP.

SendGrid SMTP Integration

  1. Install the SMTP Authentication Support module using Composer.
  2. Visit /admin/config/system/smtp once you've logged in as an administrator.
  3. From within Install Options, select On.
  4. Use the following within SMTP Server Settings:
  5. SMTP server: smtp.sendgrid.net SMTP port: 2525 Use encrypted protocol: We strongly recommend selecting TLS
  6. Provide your site-specific SendGrid credentials and click Save configuration.

The Drupal application is now ready to send emails through SendGrid. Provide an address within the Send Test E-mail configuration field and click Save configuration to test.

Checking deliverability in SendGrid

For testing purposes, our first few deliveries had be to email addresses that we could verify directly. We tracked and measured unique aspects of mail behaviors from within our site's SendGrid account, which we monitored.

For that first, we logged into SendGrid and selected Activity. It will take us to a page with a form to search by email. Enter the email address, and press Enter. SendGrid will search through our mail queue for any messages sent to that address. For additional search parameters, select the filters near the top right corner.

Implementation Result

Since the site registration, products reachability, both internal and external communication etc. are through emails, the mailing system plays a very important role in the business process.

With the integration of sendGrid in the site, there are no longer any issues of the emails not reaching the recipient's inbox. The clients also benefited from the extra features that came with the integration of SendGrid.