Gmail’s Undocumented Filters

I use gmail to host my domain’s mail accounts. Mostly this has been a pure joy, particularly as it means I don’t have to pay for the storage space on my hosting account any more.

One thing, however, has been a continuing annoyance: Gmail is weaker on filtering on emails in a comprehensive way (at least vs. the the extent I could via cpanel). In particular, you can’t do “any header contains” filtering, and wildcards aren’t really supported. As a result, some known things I could filter for and send straight to trash ended up going into my spam folder.

In general gmail does spam filtering well, but because of the fact I had a domain back in the very early public internet days (so get a lot of spam to old and made up addresses) and the way I manage email addresses, it sometimes puts stuff there it shouldn’t. So I have to keep reviewing the spam folder — hence my frustration with the lack of “any header” filtering. Otherwise I could knock off all known spam (incoming at a rate of thousands of messages a day) straight to trash and that would only leave the new stuff to review in the spam folder.

Well, today I discovered that there are several undocumented filters available in gmail. Among these is a “DeliveredTo:” filter. So, let’s say you’re getting mail in your account that appears to be actually sent to “izucocomas6250@com.ar” (yes, a real spam message had this) – but it is showing up in your own account with you not listed. Most likely you are being Bcc’d on the mail. You can see this if you do a “Show Original” mail, and there will be a “Delivered-To: youremailaddress@yourdomain.tld” right at the top. Gmail normally lets you filter on From: and To: and “Has the words”, etc., from within the filter dialog. But none of these apply in this situation — luckily, DeliveredTo: does!

So how do you use DeliveredTo:? You enter it in the “Has the words” field – that’s perfectly intuitive, right? 🙂 Of course not… but that’s how it works.

So, for example, to filter for anything Bcc’d to complaints@amazon.com, under “Has the words” you’d enter:
DeliveredTo:complaints@amazon.com

Take that, spammers!