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

Discussion of features in Mozilla Thunderbird
Post Reply
postcd
Posts: 54
Joined: April 5th, 2015, 6:24 am

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

Post by postcd »

Hello,
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 [198.23.211.171] (port=54178 helo=spam.domain.here)
then in filters set next column to "contains"
next column to 198.23.211.
(that should match all IPs 198.23.211.0-198.23.211.254 - 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 spam.domain.here))

Image

Above mentioned is not convenient method. Also user should be able to use famous IP blocklists like stopforumspam.com 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.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Block/filter out messages based on sender IP range/hostn

Post by morat »

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: http://forums.mozillazine.org/viewtopic ... #p13899689

FiltaQuilla - Header Regex Match
http://quickfilters.quickfolders.org/fi ... ader_regex
postcd wrote:add custom text
BobBoffin wrote:I adapted the Javascript example to replace {Disarmed} at start of the subject line...
More info: http://forums.mozillazine.org/viewtopic ... #p14898832

FiltaQuilla - Javascript Action
http://quickfilters.quickfolders.org/fi ... ipt_action
http://searchfox.org/comm-esr78/search? ... 8&path=idl
http://searchfox.org/comm-esr91/search? ... 8&path=idl

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

e.g.

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: http://forums.mozillazine.org/viewtopic ... #p13738781
Post Reply