Manually test mail filter rules

larsen

Well-Known Member
Feb 28, 2020
173
20
58
Hi,

I have configured mail filter rules to automatically send mails with invoices to accounting. While this generally works with some senders, there is one where it does not. I have no clue what might be causing it. The subject passes the regex test and the receiving mail address is correct, too.

Is there a way to manually test this?
I think of passing the mail as a text file into some program while passing the name of the rule to be tested.
 
Thanks, but the regex is fine (as stated). I need to test the whole email.
 
You can test this with the spamassassin -t command.
This allows you to run a test email through SpamAssassin and see which rules were triggered.
Upload the message in EML format (test.eml) to the server and run:
Code:
spamassassin -t -D < test.eml
Or by explicitly specifying the rule of interest:
Code:
spamassassin -t -D rules < test.eml | grep 'YOUR_RULE_NAME'
The output will show the rule scores, for example:
Code:
3.0 YOUR_RULE_NAME …
 
Last edited:
The filter rules in question are executed after all the spam assassin rules. This is not a spam assassin problem.
 
Forwarding to the recipient(s) based on the subject or any other conditions is more a function of the mail server than the mail gateway.
The gateway's job is to validate the message and forward it to the mail server for delivery to the recipient. Or, if the message fails validation, to delay it.
You'll likely need to review your mail server logs to determine what happens to the message after it leaves the gateway.