---
title: How to clean your SendGrid email marketing lists
description: Learn how to keep your email lists extremely clean and increase your deliverability rates and keep your mailing costs down.
image: https://www.engaging.io/hubfs/Imported_Blog_Media/How-to-clean-your-SendGrid-Ema-20140520163538-2.jpg
---

[Skip to content](https://www.engaging.io/blog/how-to-clean-your-sendgrid-email-marketing-lists#main-content)

[![Engaging.io logo](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/site-logo-pack/Engaging-Logo-2026.png?width=143&name=Engaging-Logo-2026.png)](https://www.engaging.io)

[Case studies](https://www.engaging.io/case-studies)  Services  Industries  Products  About us

![search icon](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/module-icons/main-search-icon-HR.png?width=44&name=main-search-icon-HR.png)

![search close icon](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/module-icons/main-search-close-HR.png?width=24&name=main-search-close-HR.png)

[Get in touch](https://www.engaging.io/contact-us)

[AI services](https://www.engaging.io/ai-services) [Custom integrations and configuration](https://www.engaging.io/services/custom-hubspot-integrations-and-system-sync-solutions) [CRM migration and onboarding](https://www.engaging.io/services/crm-migration-to-hubspot-onboarding-implementation-services) [Custom membership portals](https://www.engaging.io/services/custom-hubspot-membership-portals-secure-self-service-platforms) [Data migrations](https://www.engaging.io/services/crm-hubspot-data-migrations) [Data cleansing](https://www.engaging.io/services/data-cleansing) [Data lakes and architecture](https://www.engaging.io/services/enterprise-data-lake-architecture-build) [Digital transformation and change management](https://www.engaging.io/services/digital-transformation-services-change-management) [Websites](https://www.engaging.io/services/hubspot-cms-websites)

[Sports and entertainment](https://www.engaging.io/sports-and-entertainment) [Medical and health](https://www.engaging.io/medical-and-health) [Education](https://www.engaging.io/education) [Restaurants and clubs](https://www.engaging.io/restaurants-and-clubs) [Experience and travel](https://www.engaging.io/experience-and-travel) [Finance](https://www.engaging.io/finance) [Property development and real estate](https://www.engaging.io/property-development-and-real-estate)

[JinnSync](https://www.engaging.io/our-products/jinnsync) [MailSync](https://www.engaging.io/our-products/mailsync) [Real Estate Syncer](https://www.engaging.io/our-products/real-estate-syncer)

[Who we are](https://www.engaging.io/who-we-are) [Life at Engaging](https://www.engaging.io/life-at-engaging) [Blog](https://www.engaging.io/blog)

[![Engaging.io logo](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/site-logo-pack/Engaging-Logo-2026.png?width=143&name=Engaging-Logo-2026.png)](https://www.engaging.io)

![menu-default-icon](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/module-icons/Menu-default.png?width=30&name=Menu-default.png) ![menu-default-icon](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/module-icons/Menu-close.png?width=30&name=Menu-close.png)

[Get in touch](https://www.engaging.io/contact-us)

![search icon](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/module-icons/main-search-icon-HR.png?width=44&name=main-search-icon-HR.png)

![search close icon](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/module-icons/main-search-close-HR.png?width=24&name=main-search-close-HR.png)

[Case studies](https://www.engaging.io/case-studies)

 Services

[AI services](https://www.engaging.io/ai-services) [Custom integrations and configuration](https://www.engaging.io/services/custom-hubspot-integrations-and-system-sync-solutions) [CRM migration and onboarding](https://www.engaging.io/services/crm-migration-to-hubspot-onboarding-implementation-services) [Custom membership portals](https://www.engaging.io/services/custom-hubspot-membership-portals-secure-self-service-platforms) [Data migrations](https://www.engaging.io/services/crm-hubspot-data-migrations) [Data cleansing](https://www.engaging.io/services/data-cleansing) [Data lakes and architecture](https://www.engaging.io/services/enterprise-data-lake-architecture-build) [Digital transformation and change management](https://www.engaging.io/services/digital-transformation-services-change-management) [Websites](https://www.engaging.io/services/hubspot-cms-websites)

 Industries

[Sports and entertainment](https://www.engaging.io/sports-and-entertainment) [Medical and health](https://www.engaging.io/medical-and-health) [Education](https://www.engaging.io/education) [Restaurants and clubs](https://www.engaging.io/restaurants-and-clubs) [Experience and travel](https://www.engaging.io/experience-and-travel) [Finance](https://www.engaging.io/finance) [Property development and real estate](https://www.engaging.io/property-development-and-real-estate)

 Products

[JinnSync](https://www.engaging.io/our-products/jinnsync) [MailSync](https://www.engaging.io/our-products/mailsync) [Real Estate Syncer](https://www.engaging.io/our-products/real-estate-syncer)

 About us

[Who we are](https://www.engaging.io/who-we-are) [Life at Engaging](https://www.engaging.io/life-at-engaging) [Blog](https://www.engaging.io/blog)

[Blogs](https://www.engaging.io/blog)

# How to clean your SendGrid email marketing lists

By Ralph Vugts on Sep 16, 2025

Narrate this article

![](https://www.engaging.io/hubfs/Imported_Blog_Media/How-to-clean-your-SendGrid-Ema-20140520163538-2.jpg)

[![Spring Cleaning](https://www.engaging.io/hs-fs/hubfs/Imported_Blog_Media/clean-sendgrid-email-list-3.jpg?width=250&height=261&name=clean-sendgrid-email-list-3.jpg)](https://www.engaging.io/hubfs/Imported_Blog_Media/clean-sendgrid-email-list-3.jpg)A few years ago I changed from Mailchimp to Sendgrid as Sendgrid has a very powerful API and was significantly cheaper (plus had a load of other nifty bits and pieces). But unfortunately it lacks a lot of great features that I had taken for granted with Mailchimp.

The main feature I missed was the ability to search contact lists for users who had not opened or clicked on an email for say, 6 months. To me these guys are dead emails and you want to either try and re-activate them by sending them a targeted email, or just prune them off your list.

By doing this you keep your lists nice and clean which increases your deliverability rates and also keeps your mailing costs down. If you have large lists, the costs and spam warnings can quickly become an issue.

The great thing about SendGrid however, is with a little programming skill, you can get this kind of info and prune your own lists.

### **Step 1: Event notifications**

First of all you are going to need to start logging who clicks and opens your emails. To do this log into SendGrid and select Apps. Turn on “Event Notifications” and select the actions you want to log.

Now for the tricky bit: You need to write a small script that will process this data and save it into your own database:  
[https://sendgrid.com/docs/API\_Reference/Webhooks/event.html](https://docs.sendgrid.com/api-reference/webhooks/get-an-event-webhook)

**Here is a PHP example that works well:**

if(isset($\_POST)){ include('../dbconnect.php'); // Dump body $DecodedJson = json\_decode($HTTP\_RAW\_POST\_DATA, true); foreach($DecodedJson as $key =&gt;$value){ //Get the data we want fromt he array $email = ''; if(isset($value\['email'\])){ $email=mysql\_real\_escape\_string($value\['email'\]); } $event = ''; if(isset($value\['event'\])){ $event=mysql\_real\_escape\_string($value\['event'\]); } $url = ''; if(isset($value\['url'\])){ $url=mysql\_real\_escape\_string($value\['url'\]); } $reason = ''; if(isset($value\['reason'\])){ $reason=mysql\_real\_escape\_string($value\['reason'\]); } $type = ''; if(isset($value\['type'\])){ $type=mysql\_real\_escape\_string($value\['type'\]); } //Insert Data into DB $sql=" INSERT INTO \`user\_activity\` (\`id\`, \`email\`, \`event\`, \`newsletter\_id\`, \`url\`, \`categories\`, \`dateadded\`) VALUES (NULL, '$email', '$event', '$newsletterid', '$url', '', CURRENT\_TIMESTAMP); "; $result=mysql\_query($sql); } // close connection mysql\_close(); }

### **Step 2: De-dupe your log table**

After a few months of logging the above data you are now ready to pull your first list of inactive email users. To speed up the database queries it’s best to create a single table of de-duped email address to compare to your main list. Use the MySQL Distinct or Group functions to do this.

### **Step 3: Create your 'to-be-unsubscribed' list**

To do this you will need 2 database tables.

1. Your entire email list
2. Your de-duped email log table

You can now LEFT JOIN these 2 tables, if there is a NULL entry for event column you know they haven’t clicked or opened anything and can kill these from your list (or try a re-activation campaign). You might also want to consider limiting the date range so newer users don’t get pruned before you have a chance to email them.

**Here is a MySQL example:**

SELECT user\_activity.event , comp\_users.country , comp\_users.email FROM comp\_users LEFT OUTER JOIN user\_activity ON comp\_users.email = user\_activity.email WHERE user\_activity.event IS NULL

### **Step 4: Unsubscribe these users from your SendGrid list**

Export your list and save it as a CSV file. You will only need a list of emails, ditch all the other columns. Log back into SendGrid, find your list and select “Manage Unsubscribes”. Upload your list and you’re done!

#### Other Blogs

#### [Leverage technology to generate sales Ralph Vugts Jul 13, 2026 See More](https://www.engaging.io/blog/leverage-technology-to-generate-sales)

#### [🎙️ From chopstick party skills to elite leadership: Michelle O’Keeffe featured... Kiara Robinson Sep 30, 2025 See More](https://www.engaging.io/blog/️-from-chopstick-party-skills-to-elite-leadership-1)

#### [Your source of truth: the practical guide to clean CRM data Michelle O'Keeffe Aug 17, 2026 See More](https://www.engaging.io/blog/your-source-of-truth-the-practical-guide-to-clean-crm-data)

### Get in touch, We love to talk

Stay ahead with expert insights

Subscribe to our newsletter for the latest strategies and smart solutions to drive business growth.

#### Services

[AI services](https://www.engaging.io/ai-services) [Custom integrations and configuration](https://www.engaging.io/services/custom-hubspot-integrations-and-system-sync-solutions) [CRM migration and onboarding](https://www.engaging.io/services/crm-migration-to-hubspot-onboarding-implementation-services) [Custom membership portals](https://www.engaging.io/services/custom-hubspot-membership-portals-secure-self-service-platforms) [Data migrations](https://www.engaging.io/services/crm-hubspot-data-migrations) [Data cleansing](https://www.engaging.io/services/data-cleansing) [Data lakes and architecture](https://www.engaging.io/services/enterprise-data-lake-architecture-build) [Digital transformation and change management](https://www.engaging.io/services/digital-transformation-services-change-management) [Websites](https://www.engaging.io/services/hubspot-cms-websites)

#### Industries

[Sports and entertainment](https://www.engaging.io/sports-and-entertainment) [Medical and health](https://www.engaging.io/medical-and-health) [Education](https://www.engaging.io/education) [Restaurants and clubs](https://www.engaging.io/restaurants-and-clubs) [Experience and travel](https://www.engaging.io/experience-and-travel) [Finance](https://www.engaging.io/finance) [Property development and real estate](https://www.engaging.io/property-development-and-real-estate)

#### PRODUCTS

[JinnSync](https://www.engaging.io/our-products/jinnsync) [MailSync](https://www.engaging.io/our-products/mailsync) [Real Estate Syncer](https://www.engaging.io/our-products/real-estate-syncer)

#### COMPANY

[Case studies](https://www.engaging.io/case-studies) [Who we are](https://www.engaging.io/who-we-are) [Life at Engaging](https://www.engaging.io/life-at-engaging) [Blog](https://www.engaging.io/blog) [Contact us](https://www.engaging.io/contact-us)

#### FOLLOW US

[![Linkedin](https://www.engaging.io/hs-fs/hubfs/Linkedin.png?width=28&name=Linkedin.png)](https://au.linkedin.com/company/engaging) [![YouTube](https://www.engaging.io/hs-fs/hubfs/Icon%20-%20YouTube.png?width=28&name=Icon%20-%20YouTube.png)](https://www.youtube.com/channel/UCoRbiw8pELknyb6K6i4E5Og)

### Good work with good people

[Privacy Policy & Terms of Service](https://www.engaging.io/privacy-and-terms)

[![engaging-logo](https://www.engaging.io/hs-fs/hubfs/raw_assets/public/Engaging-2025/images/site-logo-pack/short-form-logo/eio-logo-pink.png?width=90&name=eio-logo-pink.png)](https://www.engaging.io/)

© Copyright 2026, Engaging.io, all rights reserved

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Ralph Vugts",
    "url" : "https://www.engaging.io/blog/author/ralph"
  },
  "dateModified" : "2025-09-30T05:32:03.817Z",
  "datePublished" : "2025-09-16T01:44:18.000Z",
  "headline" : "How to clean your SendGrid email marketing lists",
  "image" : [ "https://www.engaging.io/hubfs/Imported_Blog_Media/How-to-clean-your-SendGrid-Ema-20140520163538-2.jpg" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.engaging.io/blog/how-to-clean-your-sendgrid-email-marketing-lists",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.engaging.io/hubfs/Engaging-Logo-2021.png"
    },
    "name" : "Engaging.io"
  }
}
```