User Tools

Site Tools


Spamrules example - increase spam score for long sender domain

This script is for the case where you to increase the spamminess of emails where the sender's email address contains a long domain. In this case we'll say if the sender's domain has 20 or more characters in the first section (between the @ and first .). Note that we do not necessarily recommend that you do this as it is not a very good indicator of spam, but it is something we've been asked for, so here it is.

Add the following to the spamrules_userchecks.txt file. This script file only gets processed on incoming messages (the spamrules_localmail.txt script ends the processing of locally sent messages)

DefineRule "LongSenderDomain" 1 "Rule to add score for long sender domains"
BulkScan Score [LongSenderDomain]
From /@[a-z0-9-]{20,}/i 50

When the email address in the From header field has a first domain section of 20 characters or more, then the spam filter will add '50' onto the spam score (the default threshold for messages to be marked as spam is 100) - you can alter the 50 at the end of the line as appropriate for your requirements.

The data after the From in this rule is a regular expression.

reference/spamrules_longsenderdomain.txt · Last modified: 2018/11/14 10:45 (external edit)