On 2025-03-10 at 11:42:16 UTC-0400 (Mon, 10 Mar 2025 16:42:16 +0100)
Rainer Sokoll via users <rainer+spamassassin.apache....@sokoll.com>
is rumored to have said:

> Hi,
>
> SpamAssassin version 4.0.0
>   running on Perl version 5.36.0
>
> Debian 12 (bookworm)
>
> I’m pulling my hair out.
> A simple mail containing
>
> ------[snip]-----
> teststring
> some random text
> ------[snap]-----
>
> and a rule in local.cf:
> body TESTRULE /teststring$/
> score TESTRULE 5.0
>
> does NOT match when testing with spamassassin -t

Because 'body' rules match against a pre-processed form of the message, as 
documented ('perldoc Mail::SpamAssassin::Conf'):

        All body paragraphs (double-newline-separated blocks text) are
        turned into a linebreaks-removed, whitespace-normalized, single
        line. Any lines longer than 2kB are split into shorter separate
        lines (from a boundary when possible), this may unexpectedly prevent
        pattern from matching. Patterns are matched independently against
        each of these lines.

        Note that by default the message Subject header is considered part
        of the body and becomes the first line when running the rules. If
        you don't want to match Subject along with body text, use "tflags
        RULENAME nosubject".

The effect of this preprocessing is that to match line endings that are not 
"paragraph" endings (i.e. 2 newlines) you need to use 'rawbody' or 'full' 
instead. The details of those message forms are also included in the perldoc 
(which your system may have rendered to a man page)




-- 
Bill Cole

Reply via email to