Virtualmin GPL Antispam

Is there a way to filter incoming mail by words/wildcards in message subjects/bodies?
Like delete messages on the server on arrival with word “viagra” in subject or body, or certain email addresses, etc?
So much stuff coming in every day… ;(((


One way to do that would be to create custom SpamAssassin filters.

To do that, log into Virtualmin, and click Webmin -> Servers -> SpamAssassin -> Header and Body Tests.

You can then create custom rules that look for a word or words, and have that increase the SpamAssassin score.


thanks Eric
any examples, manuals available for that setting?
I’m not sure what to put in these fields
and cant see anything about it on your website



Well, you’d be generating SpamAssassin rules, so you may want to take a peek at some of the SpamAssassin rule files to get an example of what they might look like.

However, I believe what you’re adding here are regular expressions.

Unfortunately, I don’t know the specifics of how that screen works, you might need to tinker with it a bit to get things working the way you want.

You could try creating a rule that looks for “Foo” in the headers, send yourself an email with “Foo” in the subject, and look at the X-Spam-Status email header to see if SpamAssassin listed your rule in there.


I know this is an old topic, but, in General - what is the best way to fight Spam?
I’ve got Centos 5.5 with Webmin/Virtualmin GPL (all settings are default for SpamAssassin and mailer is Postfix). And settings are on “Deliver normally”

Always been doing it via Outlook plugin and Rules/Alerts (I’ve got a list of ‘badwords’ which would be ideal to put on server and delete junk right on arrival if words match in body or subject, like Viagra, Diploma, etc.)

Whats the best way to do this? Can someone give some examples please?
Like letters with these words I want to KILL right on the server, not mark as spam, but to DELETE!


Well, first off, I’d suggest enabling greylisting if you haven’t already. That can drop your incoming spam by quite a bit.

As far as looking for keywords – my recommendation would be to go into Webmin -> Servers -> SpamAssassin -> Head and Body checks, and to setup rules there that look for the specific keywords you’re looking to flag.

I know you could use Postfix to automatically kill an email containing a word, though I don’t know how to do that off the top of my head :slight_smile:


Getting back to this topic, greylisting helps a lot, but at the moment because i don’t know how to do regular expressions spam filter it still misused.
I’ve got emails coming in as usual but with [SPAM] subject added RANDOMLY (i guess it’s because “untrained” spamassassin?) Is spamassassin just changing header script? Emails from popular resources like get marked as [SPAM] and i didn’t change default settings for my domains.
Still not sure how to teach spamassassin it eliminate spam. I can dig in to messages “spamscore” headers in Outlook when they arrive with this subject but that’s about it…
Any ideas?