Testing custom SpamAssassin rules

As I was writing and testing my custom SpamAssassin rules, I often tried to figure out how to make sure my rule was running in production. I could easily test it locally by using the SpamAssassin command-line. But for production, I couldn’t use the command line.

Perhaps there is a better way, but I decided to send a test spam message into the system and see how SpamAssassin handled it. The easiest way to trigger SpamAssassin to mark a message as spam is to include a URL that will trigger one of the SURBL rules.

If you look at your notification e-mails the rules will be listed near the bottom:

Note: Slightly edited to remove identifying information, including the actual URL.

Unsolicited bulk email from:

Subject: Spam is great

Content analysis details: (26.2 points, 1.0 required)

pts rule name description

—- ———————- ————————————————–

0.0 HTML_MESSAGE BODY: HTML included in message

4.5 URIBL_SC_SURBL Contains an URL listed in the SC SURBL blocklist

[URIs: spamurl.com]

3.8 URIBL_AB_SURBL Contains an URL listed in the AB SURBL blocklist

[URIs: spamurl.com]

4.1 URIBL_JP_SURBL Contains an URL listed in the JP SURBL blocklist

[URIs: spamurl.com]

3.0 URIBL_OB_SURBL Contains an URL listed in the OB SURBL blocklist

[URIs: spamurl.com]

Simply grab the URL (spamurl.com in this case) and paste it into a message. Send the message from the outside to a recipient behind SpamAssassin. It should trigger the rules engine, and you should hopefully see your rule fire in the new notification message.

Unsolicited bulk email from:

Subject: Spam is great

Content analysis details: (26.3 points, 1.0 required)

pts rule name description

—- ———————- ————————————————–

0.0 HTML_MESSAGE BODY: HTML included in message

4.5 URIBL_SC_SURBL Contains an URL listed in the SC SURBL blocklist

[URIs: spamurl.com]

3.8 URIBL_AB_SURBL Contains an URL listed in the AB SURBL blocklist

[URIs: spamurl.com]

4.1 URIBL_JP_SURBL Contains an URL listed in the JP SURBL blocklist

[URIs: spamurl.com]

3.0 URIBL_OB_SURBL Contains an URL listed in the OB SURBL blocklist

[URIs: spamurl.com]

0.1 AD_CUSTOM_RULE Custom rule fired!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>