-1

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: myname@thisdomain.com
Subject: myname 3679273

or

To: john.doe@thatdomain.com
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?

Rob
  • 155
  • 1
  • 12

2 Answers2

1

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.

  • Yeah, I eventually figured that out. Thanks though for replying. I'll give you the points. – Rob Jun 30 '17 at 21:33
1

The accepted answer is not true.

You can write complex rules like:

header      RULE_EXAMPLE_FROM        From =~ /\@example.com/i
header      RULE_EXAMPLE_SUBJECT     Subject =~ /whatever/i
meta        RULE_EXAMPLE             RULE_EXAMPLE_FROM && RULE_EXAMPLE_SUBJECT
score       RULE_EXAMPLE             +2000
describe    RULE_EXAMPLE             Spam caught
usr1000821509
  • 11
  • 1
  • 2
  • The original question was: "a rule that will trigger when the user part of the 'To:' header is present in the subject line". I do not see how your solution solves that problem. I can change From to To, as asked, but even then. Where do you search the subject for the username part from the To address? You use literals, but the rule cannot use literals because the "example.com" and "whatever" are not know up front. Can you please elaborate your solution? – Rob Sep 28 '22 at 15:41