Re: line endings in body tests

Shawn Iverson <[email protected]>
Newsgroups gmane.mail.spam.spamassassin.general
Message-ID <CACg3fsZA-CruOPwZu0Py-iKs-sMKj1EJ23wXtfNXmU=T4D3MbA@mail.gmail.com>
Rainer,

Take a look at
https://spamassassin.apache.org/full/4.0.x/doc/Mail_SpamAssassin_Conf.html

body SYMBOLIC_TEST_NAME /pattern/modifiers

...

"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."

On Mon, Mar 10, 2025 at 11:42 AM Rainer Sokoll via users <
[email protected]> wrote:

> 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
> BUT when the mail body looks like
>
> ------[snip]-----
> teststring
>
> sometext
> ------[snap]-----
>
> the rule matches - why, why, why? There are no additional or hidden
> control characters.
>
> body TESTRULE /^teststring/
> score TESTRULE 5.0
>
> matches in any case. spamassassin --lint does not complain.
> I’m going slightly mad 🙁
>
> Background: I want to tag all mails that have lines ending with " ."
> (space period), if this pattern occures at least 3 times.
>
> I thought
>
> ------[snip]-----
> body __2025030701 /\s\.$/
> tflags __2025030701 multiple
> meta 2025030701 __2025030701 >= 3
> score 2025030701 5.0
> describe 2025030701 Mindestens 3 Zeilen enden auf " ."
> ------[snap]-----
>
> would do this, but I cannot get spamassassin to recognize the line endings.
>
> Any hint is appreciated,
>
> Rainer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.