Advanced Spam Filter Settings in Virtualmin for Small Organizations

Learn how to configure advanced spam filters in Virtualmin to protect your small organization from unwanted emails. Step-by-step guide with tips.

Why Advanced Spam Filters in Virtualmin?

Spam is not only annoying, but can also pose security risks for your organization. With Virtualmin, you have the ability to configure powerful filters beyond the basic settings. In this article, we show you how to effectively protect your email communication.

Basic Spam Protection Mechanisms in Virtualmin

Virtualmin uses SpamAssassin and ClamAV by default. Before moving to advanced settings, ensure these services are enabled:

  • Go to Services → SpamAssassin and enable it for your domain.
  • Make sure ClamAV is running under Services → ClamAV Scanner.

Advanced SpamAssassin Configuration

SpamAssassin offers numerous options to improve filter accuracy. Here are some recommended settings:

Adding Custom Rules

You can create your own rules in the file /etc/mail/spamassassin/local.cf. Example:

# High score for suspicious attachments
body LOCAL_ATTACHMENT /\b(?:doc|pdf|zip|exe)\b/i
score LOCAL_ATTACHMENT 3.0

Training the Bayes Filter

The Bayes filter learns from your markings. To train it:

  • Mark spam emails as spam in your email client.
  • Virtualmin automatically stores them in a training folder (e.g., .Spam).
  • Run sa-learn --spam /home/user/mail/.Spam regularly.

Greylisting for Additional Security

Greylisting delays the delivery of emails from unknown senders. This significantly reduces spam. Enable it in Virtualmin under Services → Greylisting. By default, emails are delayed by 5 minutes – acceptable for most organizations.

Setting Up DKIM, SPF, and DMARC

These authentication methods prevent your domain from being used for spoofing. Here's how to set them up:

  • SPF: Add a TXT record in your DNS zone: v=spf1 mx -all
  • DKIM: Go to Services → DKIM and enable it. Virtualmin automatically generates a public key.
  • DMARC: Create a TXT record: v=DMARC1; p=quarantine; rua=mailto:admin@yourdomain.com

Monitoring and Fine-Tuning

Regularly monitor the spam rate in Virtualmin under Reports → Mail Statistics. If too many legitimate emails are blocked, lower the SpamAssassin score or add whitelist entries.

With these advanced settings, you are well-equipped. If you don't have your own server yet, check out our Virtual Servers – ideal for small organizations. And for a professional email solution, we offer Managed Hosting with full support.