Spam filtering on Mailcow is done by Rspamd, a fast, scriptable engine that scores every message using hundreds of checks: SPF, DKIM, DMARC, blacklists, content rules, a Bayesian classifier and more. The default setup is good, but every environment is different, and sooner or later you will see spam reaching inboxes or legitimate mail landing in the junk folder. This Mailcow Rspamd guide shows how to look at what Rspamd is doing, change its thresholds, use allow and block lists, train it and fix false positives without breaking things.
This post follows the Mailcow documentation as of November 2026. File locations and options can change, so check the documentation for your version. If you are new to Mailcow, start with How to Install Mailcow.
How Rspamd Decides: Scores and Actions
Each check adds or subtracts points. The total score decides the action:
| Action | Effect | Example threshold |
|---|---|---|
| No action | Delivered normally | Below the lowest threshold |
| Greylist | Temporary rejection so legitimate servers retry | 7 |
| Add header (junk) | Delivered with a spam header, so it goes to the Junk folder | 8 |
| Reject | Refused during the SMTP conversation | 15 |
The example values (greylist = 7; add_header = 8; reject = 15) are the ones Mailcow’s documentation uses to show the syntax, and your installation may differ. Changing them is the simplest way to be stricter or more lenient.
Step 1: Open the Mailcow Rspamd Web UI
In the Mailcow admin interface, go to System » Configuration » Access and find the Rspamd UI section, where you set a password for it. The initial password is random. Then open:
https://mail.example.com/rspamd
The History tab shows each message with its score, the action taken and the symbols (rules) that fired, which tells you exactly why something was judged spam or ham. Use it as your first diagnostic step for any complaint. The Symbols tab lists all rules and their weights.
Step 2: Change Thresholds and Rejection Messages
Mailcow keeps customisations in files under data/conf/rspamd/ in the Mailcow directory, so updates do not overwrite them. For global score thresholds create data/conf/rspamd/local.d/actions.conf:
reject = 15;
add_header = 8;
greylist = 7;
Lowering add_header catches more spam but risks more false positives. Raise it if legitimate mail reaches the junk folder. You can also change the rejection text and behaviour in data/conf/rspamd/override.d/worker-proxy.custom.inc, for example:
reject_message = "Message rejected as spam";
To keep a longer scan history in the UI, set nrows in local.d/history_redis.conf:
nrows = 1000;
Apply any change by restarting the container from the Mailcow directory:
docker compose restart rspamd-mailcow
Make a copy of any file before editing it, and change one thing at a time so you can see the effect.
Step 3: Allow Lists and Block Lists (Without Editing Files)
For most administrators the interface is easier and safer than files.
- Per domain: open Mail setup » Domains, edit the domain and use the Spam filter section to add allow-listed and block-listed senders
- Per user: users can set their own lists, which can override the domain list
- Server-wide: the global filter maps in the configuration area. The documentation marks this part as still being worked on, so check what your version offers
What to allow-list: trusted business partners whose mail keeps being flagged, and your own systems. What not to do: allow-list a whole domain just because one message was blocked. Use the narrowest rule possible (an exact address) and review lists every few months. Bear in mind that an allow-listed sender who gets hacked can send spam straight to your users.
Step 4: Train Rspamd with Ham and Spam
Rspamd’s Bayesian classifier improves with examples.
- User training: when a user moves a message into the Junk folder, Rspamd learns it as spam. Moving it out of Junk into the inbox teaches it as ham. This works through Mailcow’s Sieve integration. Moving a message to Trash does not train it
- Bulk training from the command line: useful for a folder of known spam or known good mail:
docker exec -i $(docker compose ps -q rspamd-mailcow) rspamc learn_spam < spam-message.eml
docker exec -i $(docker compose ps -q rspamd-mailcow) rspamc learn_ham < good-message.eml
Aim for balance, since training only on spam skews the filter. A few hundred examples of each give the classifier a useful start.
If training has gone badly wrong, the documentation describes resetting learned data by deleting the Redis keys used by the Bayes classifier (BAYES_* and RS*), neural network (rn_*) and fuzzy storage (fuzzy*). Back up Redis first, because this removes everything the filter has learned.
Step 5: Fix a False Positive
When a wanted message ends up in Junk or is rejected:
- Find it in the Rspamd History and note the score and the symbols
- Look for the rule or rules adding the most points
- Check whether the sender’s authentication is at fault. Missing SPF or DKIM on their side, or a broken forward, is a common reason; see ARC headers and forwarded mail and How to read DMARC reports
- Ask the sender to fix their DNS records if they are wrong. That is the real cure
- As a stopgap, add the sender to the allow list (narrowly) or train the message as ham
- Only then consider adjusting a rule weight
Step 6: Fix Spam Getting Through
- Open the History entry for the spam message and see which symbols fired and which did not
- Check that RBL (blacklist) lookups work. DNS blacklists need a working resolver on the server, and some public resolvers are blocked by blacklist providers
- Check that ClamAV and the Sanesecurity signature feeds update. Outbound access to the signature servers must work
- Train missed spam as spam, and lower the
add_headerthreshold a little - Block abusive senders at the domain level in the spam filter settings
- Confirm your own SPF and DMARC are strict, since spoofing of your own domain should be rejected
Protect Your Own Outgoing Reputation
Spam filtering also protects other people from your server. Set per-mailbox sending limits, watch the mail queue, and take action fast if an account is compromised. If your IP lands on a blacklist, see How to Get Delisted from Spamhaus, Barracuda and Other Blacklists.
Tuning Checklist
- Rspamd UI enabled with a strong password, and not exposed unnecessarily
- Thresholds reviewed, with changes made one at a time and recorded
- Allow lists narrow and reviewed regularly
- Training from users working (Junk folder moves)
- History reviewed after every complaint
- RBL lookups and signature updates verified
- Redis backed up before any reset
Frequently Asked Questions
How do I whitelist a sender in Mailcow?
Edit the domain (or a user’s settings) and add the sender to the allow list in the spam filter section. Use an exact address where possible.
Where is the Rspamd web interface in Mailcow?
At https://your-mail-host/rspamd, after you set an Rspamd UI password in System » Configuration » Access.
Why is legitimate mail marked as spam?
The History tab shows which rules fired. Often the sender has missing or broken SPF, DKIM or DMARC. Ask them to fix it and train the message as ham.
Do my custom Rspamd settings survive updates?
Settings in data/conf/rspamd/local.d and override.d are kept by Mailcow’s update process, but you should still back up your configuration before updating.
How do I train Rspamd to recognise spam?
Move spam into the Junk folder, which teaches the classifier automatically, or use rspamc learn_spam for bulk training.
