Block/filter out messages based on sender IP range/hostname

Discussion of features in Mozilla Thunderbird
Posts: 49
Joined: April 5th, 2015, 6:24 am

Post Posted November 25th, 2021, 3:09 am

it turns out i am receiving unsolicited messages from IP ranges of a certain SPAM company.
It should be easy for the TB user to block messages from certain IPs, ranges. Yet it does not seem obvious for me on how to do it in TB 91.3.2 or to find extension which allows this.

- - -
So far i have found this way (it was not user friendly to discover how to do it):

Thunderbird how to delete/filter out e-mail based on sender IP address/hostname

Tools/Message Filters
select e-mail account that receives the SPAM (unsure how to make filter for all)
New (button)
set name for example: Delete if sender IP or hostname contains
set radio button "Match any of the following"
set new rule: Customize...
set header variable: Received
(because when you click SPAM mail in inbox, "More" button, "View source", you could see following line for example:
Received: from [] (port=54178
then in filters set next column to "contains"
next column to 198.23.211.
(that should match all IPs - use only if you are receiving many messages from single SPAM range (IP differs only in last octet: x.x.x.0-x.x.x.254, else you would use single full IP or a hostname


Above mentioned is not convenient method. Also user should be able to use famous IP blocklists like instead of manually researching every SPAM message source and manually adding new IP filter each time, it is a joke.

Btw. i am wondering on how to forward SPAM e-mail as an attachment or print source code of the spam mail into forwarded message. Or at least add custom text to forwarded message.

Posts: 4944
Joined: February 3rd, 2009, 6:29 pm

Post Posted November 25th, 2021, 4:45 am

FiltaQuilla may be able to do that.

LP_TB wrote:I use the addon FiltaQuilla to block IP's from known spammers and entire IP ranges like Nigeria.

More info: viewtopic.php?p=13899689#p13899689

FiltaQuilla - Header Regex Match

postcd wrote:add custom text

BobBoffin wrote:I adapted the Javascript example to replace {Disarmed} at start of the subject line...

More info: viewtopic.php?p=14898832#p14898832

FiltaQuilla - Javascript Action

The [Hello, world] example is obsolete in Thunderbird 91. The msgHdrs variable is now a standard JavaScript array.


Code: Select all
/* Javascript Action */
for (var i = 0; i < msgHdrs.length; i++) {
  var msgHdr = msgHdrs[i];
  msgHdr.subject = "[SPAM] " + msgHdr.subject;

I'm not sure if you can use the nsIMsgComposeService.forwardMessage API to automatically forward a message as an attachment in a Javascript Action.

More info: viewtopic.php?p=13738781#p13738781

Return to Thunderbird Features

Who is online

Users browsing this forum: No registered users and 2 guests