Search code examples
regexrulesubjectspamassassin

Spamassassin rule that compares part of the To: header with part of the subject line


I am trying to write a rule that will trigger when the user part of the 'To:' header is present in the subject line, followed by a number or preceded by a number.

For example

To: [email protected]
Subject: myname 3679273

or

To: [email protected]
Subject: 72835 john.doe

There is an existing rule that checks if the entire To address is present in the subject (TO_IN_SUBJ). I am looking for something similar, but I want to test only for the part before the @ in the To address. Is that even possible?


Solution

  • As-is spamassassin rules don't have this ability to directly to compare header A to header B. You need to script something to do it.