SA Bugzilla – Bug 5372
Untrustworthy Received headers cannot match start-of-line anchor
Last modified: 2007-03-09 04:14:22 UTC
Rules matching Received headers other than the first one which are not readily parseable or maybe not worth parsing (i.e. untrustworthy) never match a pattern starting with '^' For example, this header from actual spam: Received: by smtp.sisencenenged.com id htv5q204a2gi; Thu, 8 Mar 2007 00:38:45 -0800 (envelope-from <wegotthetab@muspclogeda.com>) Will not match this test rule: header TEST_RCVD_FORMAT1 Received =~ /^by smtp/ but will match: header TEST_RCVD_FORMAT1 Received =~ /by smtp/ If I strip out the valid Received headers from the message so that the given one is the only Received heaer, the anchored pattern matches.
You need to tell Perl it's a multi-line field with the m modifier: header TEST_RCVD_FORMAT1 Received =~ /^by smtp/m Tested and works here.
thanks Nick.