Spam filtering
Check incoming mail with Rspamd, file spam in each mailbox's Junk folder, and refuse mail that scores very high.
Each mail server can filter spam. Rspamd checks every message that arrives: the sender's records (SPF, DKIM, DMARC), blocklists of known spam sources and the message itself, and gives it a score.
| Score | What happens |
|---|---|
| Below the junk score | The message goes to the inbox. |
| At or above the junk score (6 by default) | The message goes to the mailbox's Junk folder. |
| At or above the refuse score (15 by default) | The mail server refuses the message, so the sender is told. |
Spam in the Junk folder is not lost: people find it there in their mail app or in webmail.
Spam filtering needs agent 0.45.0 or newer on the server.
How it works
- Postfix asks Rspamd about each message as it arrives (Rspamd listens on
127.0.0.1only). - Above the junk score, Rspamd adds an
X-Spam: Yesheader. A Sieve rule that Dovecot runs before delivery moves those messages to the mailbox's Junk folder, and makes the folder when it is missing. - Above the refuse score, Postfix refuses the message during delivery.
- Rspamd signs nothing: OpenDKIM still signs outgoing mail.
- Rspamd keeps no state of its own, so there is no greylisting and no Bayes learning yet.
Turn it on
Open the mail server
Go to Web > Email. On the Mail servers card, click Filter spam next to a mail server that is set up.
Set the scores
Tick Filter spam and check the two scores:
| Field | Notes |
|---|---|
| Junk folder from score | 1 to 50. Default 6. Lower catches more spam, and more good mail by mistake. |
| Refuse from score | 5 to 100, and higher than the junk score. Default 15. |
Turn it on
Click Turn on. The agent installs Rspamd and the Dovecot Sieve plugin when they are missing, which takes a minute or two.
When the change has reached the server, the card shows Spam filter on · junk from and the junk score.
To change the scores later, click Spam filter on the card, change them and click Save and apply.
Turn it off
Click Spam filter, untick Filter spam and click Turn off. Postfix stops asking Rspamd, Dovecot's Sieve rule is removed and Rspamd is stopped, but stays installed. All mail goes to the inbox again. Mail already in Junk folders stays there.
On the server
| File | Contents |
|---|---|
/etc/rspamd/local.d/ | Rspamd's settings: actions.conf (the scores), worker-proxy.inc, worker-controller.inc, milter_headers.conf and dkim_signing.conf. |
/etc/dovecot/conf.d/99-vp-spam.conf | Dovecot's Sieve settings. Removed when filtering is off. |
/etc/dovecot/vaultpanel/spam.sieve | The rule that files spam in Junk. |
The panel writes these files whole each time the setting changes, so edits by hand are lost. Rspamd's own web interface listens on 127.0.0.1:11334, on the server only.
Each file is checked before it is used (rspamadm configtest, doveconf -n, postfix check). A file that is refused is put back as it was, and the change fails with the error in its log.
Troubleshooting
- Good mail lands in Junk. Raise the junk score a little, for example from 6 to 8. Ask the sender to set up SPF, DKIM and DMARC for their domain.
- Too much spam reaches the inbox. Lower the junk score a little. Keep the refuse score well above it, so only clear spam is refused.
- The change failed. Click Details on the Mail servers card to read the operation log.
Permissions
Changing spam filtering needs mail.manage. Hosting customers do not see email hosting.
See also Set spam filtering in the API reference.
Email hosting
Host email for your domains on your own servers with Postfix, Dovecot and OpenDKIM, with mailboxes, forwarders, DKIM signing and the DNS records receivers check.
Webmail
Give your mailboxes webmail with Roundcube from the app installer, on a website of its own, and keep it up to date by hand or automatically.