How to Block/Filter Emails by Header in Gmail


The goal of any email management system is to save you precious time and maintain a more organized inbox, regardless of what email provider you use. In Gmail, filters often play an important role in all of this, but they do have their limitations. Have you ever wondered if they can be applied to email headers apart from the standard "From", "To", and "Subject"? Let's see how this can be done.

What are Email Headers?

Email headers play a huge part in the "behind-the-scenes" of email communication, carrying information about the email, which can be added by the origin email server, intermediate servers, and the destination email server.

Every email you receive comes with meta-information that includes detailed routing information, email origination and destination points (including any intermediate hops), time stamps, and more. This data, carried in the email headers, can be viewed by enabling the "Show original" option in Gmail. It is used by email servers to route the email to the correct destination, as well as for backend spam detection, validation, and more.

Here are a few examples of common email headers and their possible values:

From: John Doe <[email protected]>
To: Jane Doe <[email protected]>
Subject: Hello, Jane!
Date: Fri, 21 May 2021 12:00:00 -0400
Message-ID: <[email protected]>
Received: from ( []) by with ESMTPS id 1234567890.
X-Mailer: Microsoft Outlook 16.0
Content-Type: text/plain; charset="utf-8"
List-Unsubscribe: <mailto:[email protected]?subject=MailStop&body=fb295d58-b745-42f7-89ba-f181ef89c7f6_24023>, <>
List-Unsubscribe-Post: List-Unsubscribe=One-Click

As you can see, there is a lot of information here, much of which can be used for creating more advanced filters and blocks.

Gmail Filter Limitations

While filters are a popular feature within Gmail, they do come with their limitations. Namely, they can only be applied to the following email headers:

  • From
  • To
  • Subject

Unfortunately, Gmail does not allow us to apply filters based on any other header information. The idea of weeding out annoying promotional emails from "[email protected]" based on validation information, routing path, or other header information seems far-fetched.

But don't worry! Block Sender can help.

Blocking Emails by Header with Block Sender

When Gmail's limitations set in, third-party Gmail extensions like Block Sender come into play. Block Sender empowers you to block emails based on headers other than the usual "From", "To", or "Subject". If you identify an irritating pattern in the email headers (like a specific sending server, "delivered to" address, or "X-Mailer" type), you now have a way to keep those emails from hitting your inbox.

Note: Block Sender works by connecting to your Gmail account through a secure method and checking all incoming emails against your list of blocking rules. Our system is audited yearly and approved by Google to be safe and secure for your account.

To create a header block, follow these steps:

  • Open the Block Sender dashboard and link your email if you haven't already.
  • Open the "Blocks" page.
  • Click the "New Blocking Rule" button.
  • Under the "I want to block..." dropdown, select "Header".
  • In the fields below, enter the following:
    • Header name: This is where you specify which header to block on. In our example screenshot, we're checking the "Received-SDF" header.
    • Matching: The next input tells us how to match your given value to the header value. Since many headers contain a lot of information, it would be difficult to match the entire header value. Instead, we just want to know if the header starts with our value.
    • Value: This is the value you want to match within the header.
  • Select the accounts to apply this to, where the email should go, and if we should send a bounce-back. In our example, we're blocking emails that failed the SPF check.
  • Click "Create"

Strategies for Filtering Emails by Header

Filtering by header is definitely an advanced technique, and it requires a bit of knowledge about email headers and how they work. Here are a few strategies you can use to filter emails by header:

1. "Received" Header

The "Received" header is added by each email server that processes the email. It contains information about the server that processed the email, the time it was processed, and more. You can use this header to block emails from a specific server or domain. This is helpful if you want to block by the sending service, like AWS SES.

2. "X-Mailer" Header

The "X-Mailer" header contains information about the email client used to send the email. You can use this header to block emails sent from a specific email client. This is helpful if you want to block emails sent from a specific email client, like Microsoft Outlook.

3. "List-Unsubscribe" Header

The "List-Unsubscribe" header contains information about how to unsubscribe from the email list. You can use this header to block emails from a specific email list. This is helpful if you want to block emails coming from an email list, which oftentimes are promotional emails.

4. Validation Headers

Headers like "Received-SPF" and "Authentication-Results" contain validation information for the email. You can use these headers to block emails that fail validation checks. This is helpful if you want to block emails that are likely to be spam or phishing emails.


So, is it possible to create a Gmail filter that works on headers other than From, To, and Subject? Gmail's built-in filtering capability is slightly limited, so the answer there is no. However, with third-party tools like Block Sender, it's entirely possible.

By using Block Sender, you can create filters based on any email header, allowing you to block emails based on any email meta data, like the server that processed the email, the email client used to send the email, the email list the email is part of, and much more. This can help you keep your inbox organized and free of unwanted emails.

Last Updated: March 12th, 2024
Was this article helpful?

Better email blocking for Gmail.

Sign up for free, no credit card required, upgrade or downgrade at any time.