I currently use Mailgun as the outbound SMTP provider for my self-hosted Discourse installation, which runs on an externally hosted Ubuntu VPS.
Recently, I have been experiencing recurring SMTP errors, including:
421 Domain is not allowed to send: recipient limit (26) exceeded
421 Domain is not allowed to send: daily request limit (100) exceeded
535 Authentication failed
Mailgun has also sent notifications confirming that my account is on probation and that my domains are limited to 100 messages per hour.
I have been exploring alternative SMTP arrangements, including Azure Communication Services Email. However, Microsoft has announced that its standalone Email service will be retired on 30 September 2028.
Another possibility I have come across is Apache James:
Has anyone here had experience using Apache James as an SMTP server for a self-hosted Discourse installation?
I would be particularly interested in:
SMTP compatibility with Discourse.
Reliability and message queue management.
Maintenance requirements compared with managed SMTP providers.
Email deliverability and sender reputation.
How Discourse handles temporary SMTP failures and subsequent retries.
I already use the standard Discourse mail-receiver container for incoming email, so my main interest is outbound transactional email.
The challenge with self-hosting outbound email isn’t so much running an SMTP server as establishing and maintaining a reputation.
You cannot simply spin up a mail server on a VPS and expect other mail servers to trust it. Even with correctly configured SPF, DKIM, DMARC and reverse DNS, an IP address with no established sending reputation may find its emails rejected, throttled or consigned to spam.
A significant part of what you’re paying a managed SMTP provider for is reputation management, not the SMTP infrastructure itself.
I’d be inclined to change providers rather than inherit that administrative burden.
I haven’t had any real problem at other places, except for those shitty “blocklists” which just block complete ranges of hosting companies and hold your server for ransom (as in you need to regularly pay them to stay off those lists). Those blocklists rarely result in actual blocks, just increases the threshold for spam filters.
So you either hand over privacy and security for your users to big tech for sending emails, or you trying to handle email yourself, there is the option to fork over (quite) a bit of money to send email via some smaller mail handling companies. But in that case you might also risk the privacy issue/security issue, and still have the risk of the same email sending issues you get when sending the SMTP yourself.
My particular use case is slightly unusual in that approximately 95% of the current outbound email traffic is destined for addresses within my own Microsoft 365 tenant, over which I have administrative control.
One potential solution I have been considering is Microsoft 365 High Volume Email (HVE) for internal recipients, alongside a conventional managed SMTP provider for external recipients.
I have also been considering a potential Discourse Multisite model involving individual private study spaces for university students, rather than a conventional shared public forum.
If students were to integrate their individual sites with Microsoft Power Automate using their university accounts, I would anticipate that much of the outbound email traffic would similarly be concentrated towards a single Microsoft 365 tenant.
For such a Multisite deployment, I would potentially already have a central Postfix instance routing incoming email to multiple individual mail-receiver containers.
Would it therefore make more sense to extend the use of Postfix to handle outbound SMTP routing, operate a separate outbound Postfix instance, or use something like Apache James to separate the inbound and outbound email infrastructure?
I would also be interested in whether anyone has experience using Microsoft 365 High Volume Email in conjunction with Discourse and a separate SMTP provider for external recipients.
I use Docker Mailserver and it does take a short while to get other mail servers to trust your server but so long as you aren’t using it to actually spam and you get your
I agree completely with @merefield — based on my extensive researching and testing.
I use Postfix on my dedicated server for all incoming and routing to dozens of Discourse instances (both standalone and multisites) as well as for specific email address forwards when I also need them on those domains.
I landed on MXRoute for sending from all the forums.
One addition to the helpful advice above: even when the M365 tenant is your own, mail from a self-hosted server still arrives at that tenant’s MX as ordinary inbound from the internet, so Microsoft’s filtering applies just as it would for any external sender — unless you add an inbound connector or transport rule that trusts your server’s static IP over TLS.
The domain split @merefield mentioned may also be possible entirely in Postfix: transport maps can send your tenant’s domain straight to the tenant and everything else out through a managed relay — no Discourse plugin needed, and the split stays adjustable in one small MTA config. Roughly how many recipient domains make up that external 5%? If it is only a handful, this kind of setup is very low-maintenance.
I should clarify that some emails also go to a separate Microsoft 365 tenant administered by my parents. Two subdomains of the root domain associated with my own Microsoft 365 tenant is registered as domains within their tenant.
The remaining external traffic includes notifications to my own university email address.
This potentially introduces three delivery routes:
Microsoft 365 HVE using an account within my own tenant.
Microsoft 365 HVE using a separately authenticated account within my parents’ tenant, should the volume of email destined for that tenant justify it.
A conventional managed SMTP provider for other external recipients.
My understanding is that Postfix could potentially implement this through recipient-based transport maps and separate SMTP transport definitions, particularly since both HVE accounts would use the same SMTP endpoint but require different authentication credentials.
The visible From address would not necessarily need to remain identical across the delivery routes, provided that Discourse’s dynamically generated Reply-To header was preserved.
Would this be a reasonable architecture without requiring a Discourse plugin?