[SOLVED] Spamassassin rule

olluz

Active Member
May 9, 2020
30
2
28
50
Hi!

Can anyone please help me understand why this is not working:

this is in my /etc/mail/spamassassin/custom.cf:
body __LOCAL_INDIA_BODY /\bIndia\b/i describe __LOCAL_INDIA_BODY INDIA found in body score __LOCAL_INDIA_BODY 100

when I restart the spam filter with:
systemctl restart pmg-smtp-filter

and test the rule with:
echo -e "test:test\n\nIndia" |spamassassin -t

then this is the output:
Content preview: India Content analysis details: (7.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 KAM_BLANKSUBJECT Message has a blank Subject -0.0 NO_RELAYS Informational: message was not relayed via SMTP 1.2 MISSING_HEADERS Missing To: header 2.0 PYZOR_CHECK Listed in Pyzor (https://pyzor.readthedocs.io/en/latest/) 1.4 MISSING_DATE Missing Date: header 0.1 MISSING_MID Missing Message-Id: header -0.0 NO_RECEIVED Informational: message has no Received headers 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment 1.8 MISSING_SUBJECT Missing Subject: header 1.0 MISSING_FROM Missing From: header 0.0 NO_HEADERS_MESSAGE Message appears to be missing most RFC-822 headers

Linting doesn't yield any warnings or errors, either.
spamassassin --lint
 
Hi.
As i understand, rules with __ prefix uses for Meta rules.
You should change __LOCAL_INDIA_BODY to LOCAL_INDIA_BODY and it will work

body LOCAL_INDIA_BODY /\bIndia\b/i
describe LOCAL_INDIA_BODY INDIA found in body
score LOCAL_INDIA_BODY 100

Content preview: India

Content analysis details: (112.6 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
4.5 BAYES_999 BODY: Bayes spam probability is 99.9 to 100%
[score: 0.9994]
3.5 BAYES_99 BODY: Bayes spam probability is 99 to 100%
[score: 0.9994]
0.2 KAM_BLANKSUBJECT Message has a blank Subject
1.0 MISSING_HEADERS Missing To: header
-0.0 NO_RELAYS Informational: message was not relayed via SMTP
100 LOCAL_INDIA_BODY BODY: INDIA found in body
1.4 MISSING_DATE Missing Date: header
-0.0 NO_RECEIVED Informational: message has no Received headers
0.8 MISSING_MID Missing Message-Id: header
0.2 MISSING_SUBJECT Missing Subject: header
0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict
Alignment
1.0 MISSING_FROM Missing From: header
0.0 NO_HEADERS_MESSAGE Message appears to be missing most RFC-822
headers
 
Last edited:
  • Like
Reactions: olluz
ahh, thank you so much for clarifying!
That was it! It is working now.