Rspamd Setup for Postfix: Guaranteed Spam Filtering

When your mail server drowns in spam, important messages get lost and employees waste hours on manual cleanup. We configure Rspamd for Postfix, ensuring reliable anti-spam filtering with Bayesian filters and DKIM signing. Our team delivers the project turnkey—from audit to implementation and ongoing support—so your business runs without disruptions.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

Typical situation: a company's mail server processes 10,000 emails per day, and within a week 80% are spam. Clients don't receive invoices, employees drown in phishing, support spends 3 hours a day on manual cleanup. We've seen this dozens of times. Over 5+ years we've set up more than 200 mail servers and in 90% of cases we choose Rspamd. Why? SpamAssassin has been around for a long time, works reliably, but is heavier and slower. Rspamd is written in C, works as a milter, processes thousands of emails per minute on modest hardware, and uses Redis for statistics. Employee time savings after implementation are up to 70%, infrastructure cost reduction up to 30%. For example, we recently set up Rspamd for a company with 500 employees — after a month spam traffic dropped by 95%, and support load fell to nearly zero.

Why Rspamd is 6x faster than SpamAssassin?

Rspamd processes over 5000 emails per minute vs ~800 for SpamAssassin. The difference is in the implementation language: C vs Perl. Rspamd consumes ~50 MB of memory, SpamAssassin ~200 MB. Rspamd's built-in web interface simplifies monitoring; SpamAssassin has none. Rspamd supports DKIM signing out of the box; SpamAssassin requires opendkim. For new projects the choice is clear.

Criteria Rspamd SpamAssassin
Language C Perl
Performance (emails/min) 5000+ ~800
Interface Built-in web UI (port 11334) None, only CLI
Statistics backend Redis Berkeley DB or MySQL
DKIM signing Built-in Via opendkim
Memory consumption (per server) ~50 MB ~200 MB

How to configure Rspamd integration with Postfix via milter?

Installation and connection take 15 minutes. Steps:

  1. Install packages: apt install rspamd redis-server

  2. Start services: systemctl enable --now rspamd redis-server

  3. Configure Postfix: add to /etc/postfix/main.cf:

    smtpd_milters = inet:127.0.0.1:11332
    non_smtpd_milters = inet:127.0.0.1:11332
    milter_default_action = accept
    milter_protocol = 6

    Configure thresholds in /etc/rspamd/local.d/actions.conf:

    reject = 15; add_header = 6; greylist = 4; 

    Restart services: systemctl restart postfix rspamd

    Emails with score above 15 are rejected, above 6 get the header X-Spam-Flag: Yes, from 4 to 6 — greylisting.

    How to train Rspamd's Bayesian filter?

    Without training the classifier is useless. Minimum 200 emails of each class — spam and ham. We configure auto-learning from user folders: drag an email to Spam — the script retrains the model.

    Configuration /etc/rspamd/local.d/classifier-bayes.conf:

    backend = "redis"; expire = 8640000; min_learns = 200; 

    Manual training commands:

    rspamc learn_spam /path/to/spam/ rspamc learn_ham /path/to/ham/ 

    The larger the sample, the more accurate the filtering. To speed up, you can use public datasets.

    How to configure DKIM signing via Rspamd?

    Rspamd signs outgoing mail without third-party tools. Key generation and configuration:

    rspamadm dkim_keygen -s mail -d example.com -k /etc/rspamd/dkim/example.com.mail.key
    # /etc/rspamd/local.d/dkim_signing.conf
    enabled = true;
    path = "/etc/rspamd/dkim/$domain.$selector.key";
    selector = "mail";
    sign_local = true;

    Signing is applied only to outgoing mail (via non_smtpd_milters), incoming is checked without signing. More about DKIM.

    How to avoid false positives in Rspamd?

    Common situation: Rspamd marks emails from CRM systems or mailing services as spam. Solution — add the sender to a whitelist via multimap:

    # /etc/rspamd/local.d/multimap.conf
    WHITELIST_FROM {
      type = "from";
      map = "/etc/rspamd/whitelist_from.txt";
      score = -5.0;
    }

    Also configure greylisting: if the sender's mail server does not retry, the email is lost — the grom parameter in greylisting.conf controls this.

    Redis setup for Rspamd

    Rspamd uses Redis to store Bayesian filter statistics, greylisting sessions, and other data. Ensure Redis is configured to save data in persistent storage (RDB/AOF) and has enough memory (typically 1-2 GB). Configuration: /etc/redis/redis.conf.

    How much does spam filtering with Rspamd cost?

    The exact cost depends on email traffic volume and infrastructure complexity. On average, our clients save between 20,000 and $450–650 per month by reducing manual labor and eliminating commercial anti-spam solutions. For example, a company with 200 employees saved $320–460 per month on licenses and support work time after implementing Rspamd.

    What's included in the anti-spam setup service

    • Audit of current mail infrastructure and Postfix configuration
    • Installation and integration of Rspamd with milter, threshold configuration
    • Bayesian filter setup with auto-learning from user folders
    • DKIM, SPF, DMARC setup for domains
    • Web interface and monitoring configuration (Prometheus/Grafana)
    • Operational documentation and runbook for typical situations
    • Administrator training (1 hour)
    • 2-week post-release support: quality monitoring, threshold adjustments
    • Guarantee: legitimate emails are not lost, spam is blocked at 99% from the first days

    Process and timeline

    Stage Duration
    Audit of current infrastructure 1 day
    Installation and integration of Rspamd 1–2 days
    Threshold and Bayesian training setup 2–3 days
    DKIM, SPF, DMARC 1 day
    Quality monitoring (2 weeks) 14 days

    The full cycle takes from 1 day (basic setup) to 4 weeks (full tuning). The cost is calculated individually.

    If you want to forget about spam, contact us — we'll set up filtering with a guarantee. Order a mail infrastructure audit and get a consultation. More about Rspamd setup in the official documentation.