Monday, March 11, 2013

Automatically mark junk folder as read in Thunderbird using filter

Some free mail providers, such as Yahoo Mail or Google Mail, do an excellent job of filtering spam on the server side. For me, their filters work so good that I don't even need Thunderbird's native junk mail controls, so I have completely switched them off. However, there is a drawback to this. With the native junk filter, you have the option to automatically mark junk as read. If you don't use the native junk filter, there seems to be no option to automatically mark junk as read.

However, there is a workaround for this, depending on your mail provider. Some mail providers mark spam with a special header value. Here are some examples for those headers:

  • Yahoo Mail: X-YahooFilteredBulk 186.78.214.248
  • GMX: X-GMX-Antispam: 5
  • Google Mail can actually mark junk as read on the server side, so there's no need to get this done in Thunderbird. Stop reading here.
  1. To see if your mail provider adds some kind of spam-identifying header, select a message in your junk folder, open the View menu and click Message Source.
  2. You can check for these headers in your filters. For example, in Thunderbird's filter dialog, create a new custom filter value for X-YahooFilteredBulk and set it to Contains > "." (a dot). As filter action, set it to Mark as read.
  3. Now we have our filter set up, but that's not enough. Thunderbird only runs filters on the inbox folder by default, but if your mail provider moves spam to a special junk folder, your filter won't execute. We have to setup Thunderbird to automatically run filters on all folders including the junk folder. Go to the config editor, here's how
  4. Then, create a new string preference named mail.server.default.applyIncomingFilters and set it to true. Even if it seems odd, do not create a boolean type, it has to be a string type with the value true. This option will run filters on all folders, not only the inbox folder.
  5. If you have done everything correctly, this will automatically mark all incoming mail in the junk folder as read.

1 comment: