I have an email account that forwards mail to my Gmail account. It looks like that Gmail is less strict to the emails that are forwarded to it compared to those that come to Gmail directly. It means that a lot of spam forwarded from non-Gmail account end up in the Gmail inbox.
The forwarded messages are processed by SpamAssassin that adds following headers:
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on myhost.org X-Spam-Flag: YES X-Spam-Level: ****** X-Spam-Status: Yes, score=6.4 required=5.0 tests=BAYES_99,[...] X-Spam-Report: * 4.0 BAYES_99 BODY: Bayes spam probability is 99 to 100% [more rules that matched]
I don't see any way to filter based on any of those headers. Gmail only looks for a few specific keywords in the header. When matching arbitrary words, Gmail checks the message body but not the headers.
I have shell access to that system, so I created a
.procmailrc file that I'm going to post. It solves my problem by adding a fake
Delivered-To. I would welcome refinements to that file and even more so suggestions that don't rely on the shell access.