Discourse Mailgun Routes

Summary: Accept inbound emails from Mailgun.

:link: GitHub: GitHub - Regalijan/discourse-mailgun-routes
:arrow_right: Install: Follow the plugin installation guide.

Prerequisites

  • Domain is verified with Mailgun and MX records pointed to Mailgun
  • Reply by email is configured

Configuration

  1. Obtain and set your Mailgun webhook signing key - while only steps 1 and 2 are required, now would be a great time to set up your temporary/permanent failure webhooks if you have not already done so.

  2. Head to the Mailgun receiving page and click on “Create route”.

  3. The expression type (unless you only want to receive on specific addresses) should be catch all. Check the box under “Forward” and set the URL to https://your.discourse/mailgun/routes/receive_mime

  4. Click the “Save route” button.

Release 0.2

  • Added new spam settings mailgun_spam_detection, mailgun_spam_score, dkim_domain_exclusions, and spf_domain_exclusions

To get started with these settings, head to domain settings in the Mailgun dashboard and set spam filtering to option 3.

image

If you use options 1 or 2, you must set mailgun_spam_detection to none.

5 Likes

I use Mailgun to send emails but the mail-receiver container (Direct-delivery incoming email for self-hosted sites) to recieve them. Would this plugin benefit me? Thanks.

1 Like

Unless you are utilizing a ddos protection service such as cloudflare (or your provider blocks inbound connections on port 25) it doesn’t really have any benefit over the mail-receiver setup.

Also, Mailgun stopped including routes in their pay-as-you-go plan, so if you don’t have a prepaid subscription or an older account you should just use the mail-receiver setup.

3 Likes

The mail-receiver doesn’t work properly with bounces – it doesn’t receive any bounce messages from Mailgun – "Discourse::NotFound" error when click "Email Type" field on admin/email/bounced – does that affect your view on whether to try the method described here? Thanks.

If you’re not receiving them via email at all, chances are they’re in the rejected tab (which is where they ended up for me when I used mail-receiver without webhooks).

I assume the same thing would happen using this plugin since it doesn’t do any parsing outside of dkim/spf and spam headers.

Bounce reasons are kept in mailgun logs, while it’s not ideal you can look at those in the meantime.

1 Like

No I think the mail receiver either doesn’t receive them from Mailgun (I think this) or just doesn’t send them to Discourse.

I suspect, being more recently written, this is an improvement over this older Mailgun plugin for receiving via Mailgun?

Regardless, thanks, b/c I think that old one just broke w/ Discourse v3.x!