Fully independent email with Discourse and Stalwart-mail

I’ve been using Stalwart-mail with discourse exclusively for the past months, and it works like a charm. I can now use both Submission (port 587 with STARTTLS) and Submissions (port 465 with TLS). No special configuration or setup involved.

Careful though, setting up a domain DNS records is a two-step process.

  1. First, you add a domain name in the Directory. This gives you resource records to add in your DNS zone file.
  2. Once your DNS is updated, you create a TLS provider for that domain. You should add the following hostnames: mail, autoconfig, autodiscover, and mta-tls (with your domain appended, e.g., mail.example.org).[1]
  3. After a period (seconds to minutes), the internal ACME provider will pick up the changes and obtain TLS certificates. At this point, the domain configuration will have updated the records: pick the _mta-tls RR with the new id, and all the _tlsa records, add them to your zone file, and your good to go.

Stalwart-mail now comes with very powerful spam filter and integrated fail2ban functionality (banning IP addresses that failed authentication or requested bogus URIs).


  1. note that for a minimal Stalwart-mail + Discourse setup, you probably don´t need autoconfig nor autodiscover since those are useful with IMAP clients. ↩︎