spam filter - manual adjustment by message subject | MDaemon Technologies, Ltd.

spam filter - manual adjustment by message subject


  • Hi All!

    Is it any way to add spam scoring if message subject contains some words?



  • Yes, you can add a custom rule to spamassassin to do this.  A rule such as the following added to your local.cf file will add 5 points any time "spamword" is found in the subject.

    header      SPAM_SUBJECT Subject=~ /\bspamword\b/i
    score       SPAM_SUBJECT 5.0
    describe    SPAM_SUBJECT Move to spam folder

    You can find more information on writing spamassassin rules at https://cwiki.apache.org/confluence/display/SPAMASSASSIN/writingrules

    Be sure to use a tool such as NotePad++ when editing .cf files, do not use Notepad.exe.

    If you just want to move messages to the user's spam folder when certain words are found instead of adding points to the score, you can do that with the content filter.

    [Rule010]
    RuleName=Copy to spam folder when words found in subject
    Enable=Yes
    ThisRuleCondition=Any
    ProcessQueue=BOTH
    Condition01=Subject|contained in file|AND|c:\mdaemon\spamwords.txt|
    Action01=copy to dir|"c:\MDaemon\users\$RECIPIENTDOMAIN$\$RECIPIENTMAILBOX$\Spam.IMAP\"
    Action02=delete|

     


  • Thanks a lot for your answer! Can I use regexp in "spamworld" ?


  • I'm assuming by "spamworld" you mean the text file.  In the latest version, the dialog in the content filter to configure the text file to use explains that you can use regular expressions but they have to be preceded by teh REGEX: tag.  I'm not sure what version you are running, but if your dialog does not have this, then you cannot use regular expressions. 

    You can use regular expressions in SpamAssassin rules and you can also use the "If the Subject header" condition in the content filter and change "contains" to "matches a regular expression".


  • ok, thank you everything is clear


Please login to reply this topic!