Neil Turner's Blog

Blogging about technology and randomness since 2002

Stopping image spam in Thunderbird

Via TUAW I found this rule for stopping image spam, where the body of the spam message is in an image and is usually trying to get you to buy penny stocks. Because these messages use images and not actual text, they often evade spam filters.
Having a rule for is all well and good if you use a Mac (which I do) and use (which I don’t). But thankfully you can also achieve this in Mozilla Thunderbird and it’s no less difficult to do so, either. Here’s how to do it.

Thunderbird Mail Filter screenIn Thunderbird, click on the Tools menu and select ‘Message Filters’. Click on ‘New’ and call it ‘Image Spam’. In the first box, where it says ‘Subject’, select ‘Customise…’ (the last option on the list). In ‘New Message Header’, type ‘Content-Type‘ (exactly as it is written there). Click ‘Add’, and then OK. Now, from the list marked ‘Subject’, choose the newly created ‘Content-Type’ option. Leave the middle box as ‘Contains’ and in the last box type ‘multipart/related‘, all in lowercase.
Now, where it says ‘Perform these actions’, have Thunderbird move the message to your Trash, or to a Junk folder, or whatever you like. I would not suggest ‘Delete Message’, however, as you may miss out on some emails as a result. Then click OK and dismiss the main ‘Message Filters’ dialog.
Important note: This will result in some ‘false positives’ – legitimate email that falls foul of this rule. This is why it is important that you do not delete these on sight and investigate any that are deleted. I tested this on some existing messages in my inbox and several newsletters and press releases got dumped as a result (but not many). You could add an exception to allow any senders in your address book, if you wanted to, to make this less brutal.

I did try to get this working in Outlook Express and Windows Live Mail Desktop Beta, but it won’t allow rules to be tested against custom headers like Content-Type. The full Outlook may allow this, but I don’t have it installed to check.


  1. Nice one, Neil. I’ve been putting up with piles of that kind of spam now for ages and hoping my junk control would learn about it. Very handy filter indeed!

  2. Brilliant! It works like a charm for me.
    Thank you very much for this great find.

  3. Thank you very much! This is a life saver, as this type of spam has become a huge problem for me in the last few weeks, even with my big university email address.

  4. awesome
    i suggest adding an exception for evites
    as they are the only commonly found email that is both legit and uses multipart related

  5. Brilliant – added the exception suggested re address book and tested it on all folders with 100% success and no false positives. Many thanks.

  6. Just for your information, Thunderbird has an extra rule for where the sender isn’t in my address book.
    Meaning that coupled with your rule only people that I know can send me emails with images in, which cuts down the amount of false positives.

  7. > The full Outlook may allow this, but I don’t have it installed to check.
    It appears that the full Outlook does allow this. (All versions of the full Outlook [98, 2000, 2003] support the “with specific words in the message header” condition in the Rules Wizard.)

  8. This messes up quite a few my emails (10% of filtered spam is actually valuable) so be careful with that.

  9. any advice or links on how you would exceptions to the rule, for people in your address book, for example? it’s not obvious to me. thanks.

  10. Tried this and added the exception (for address book accounts) and it’s working great!