Set up Reply via Email Support ✉

So you’d like to set up reply via email support for your Discourse forum.

:mega: Reply via email is pre-configured and enabled by default on all discourse.org hosted sites. The guide below only applies to those self-hosting.

Good news! Unlike outgoing email, which is completely unsuitable for typical consumer mail services like GMail, Outlook, Yahoo Mail, etc, incoming reply via-email tends to be extremely low volume. Unless you have a truly massive forum with a zillion people replying to notification emails, you are probably safe using, say, Gmail.

:bell: Alternately, if you aren’t comfortable using GMail for this, you can set up your own incoming email service using Straightforward direct-delivery incoming mail

So here’s how to set it up using GMail as an example.

  1. Create a new GMail account. If you do not set up a completely new email account old emails will be synced via POP3, causing unforeseen issues and sending bounce notification emails!

  2. Assign the new account a username like discourse-replies@example.com or in my case, replies@example.com (if you are using a normal GMail account replace @example.com with @gmail.com here). Give it a strong password.

  3. Log in to this account via http://mail.google.com. Accept the terms of service, enter the CAPTCHA, load the default web interface. Maybe send a test email, receive a test email. Kick the tires.

  4. POP3s access is off by default in Gmail, so turn it on via Settings, Forwarding and POP/IMAP:

    All incoming emails will be retained by default – but you can tweak as needed.

  5. Visit the Discourse settings and check the Email tab.

  6. Change the following settings:

    • reply_by_email_address enter replies+%{reply_key}@example.com
    • pop3_polling_username enter replies@example.com
    • pop3_polling_password enter the password of that email account
    • pop3_polling_host set to pop.gmail.com
    • pop3_polling_enabled set to true
    • reply_by_email_enabled set to true

There is a certain amount of polling that goes on for this account, but we’ve set it to a low, safe volume – you can configure the polling interval via the pop3 polling period setting.

We do assume that your email service supports plus addressing aka address tags, so check that before starting. GMail obviously does.

If everything is working, you should see the footer of all notification mails now tell you that you can reply either by visiting the website, or replying via email:

To respond, reply to this email or visit {topic URL} in your browser.

If things aren’t working:

  • check the /logs path on your Discourse in your web browser and look for email related error messages.

  • log into your mail account using your web browser and check for any errors or notifications.

Potential Issues

  1. We have seen difficulties when signing up for a GMail account from a different country than your server is located in. For example, if you create the Gmail account from the UK, but the server is in the USA.

  2. If you are using a GMail account (e.g. @gmail.com) or a Google Apps mailbox (e.g. a Google mailbox @yourdomain.com), you will need to create an app password for your account, which is used in place of your account password in step 6.

    Alternatively, you may enable “access from less secure apps” in Google Account settings. If not, you will receive a “POP3 authentication failed” error in Discourse. Access from “less secure apps” is disabled by default.

72 Likes
How to Use Discourse as a Private Support/Ticket System
Issues Configuring Respond by Email
How can I enable "reply to this email to respond"
Disable Reply Via Email
Confused about setting up reply by email
I cant setup smtp. I tried everything
Configuring Reply via Email :e-mail:
Reply via Email — emails not getting to the staged user
Gmail has just started preventing Discourse from logging in to check for reply-by email notices
Notification Email From Set to noreply?
'hostname "mail.domain.tld" does not match the server certificate' :: SNI support? & how to query cert from Discourse container?
No received mails in new Discourse installation
Mail Posting Configuration
How might we better structure #howto?
How might we better structure #howto?
How should Discourse System Market itself?
Instant notification for every new topic/reply
Email polling error with Google Apps
Discourse setting Reply-To value in `From` header field when using reply by eMail feature
Disable reply via email?
Configuring authentication checks on incoming email
Reply-by email POP3 polling hosted with roundcube
Direct-delivery incoming email for self-hosted sites
Installation by the book
Email support with discourse
Webhook to forward posts to a mailinglist: best practice?
Prevent creation of staged user for emails with auto-xyz header
Replacing Mailing lists: Email-In
Some questions regarding to pop polling, wildcards and MX
Message 'receiver' not in view until they reply
Customize the "reply to" address in new private message notification emails
Mail-receiver relay access denied
What is "Mailing List mode"?
Email notifications reply directly to me (the admin)
Notification email cannot be the same as reply by email
Email in to a private category
Using subject line for reply-by-email identifier
Free Discourse forum hosting for community-friendly GitHub projects

I posted this elsewhere, but thought this might be useful to others here / perhaps edited into the original post.

If you end up with a setup like this after using Gmail for you incoming mailbox …

You can clean up your branding here and stop the user from seeing emails from @gmail.com even when you don’t have mail alias support (username+alias@example.com) with your mail server:

  1. Setup a subdomain reply.my-discourse-site.com
  2. Add additional domain reply.my-discourse-site.com to outgoing mail provider.
  3. Add “TXT” DNS records for SPF / DKIM to reply.my-discourse-site.com provided by your outgoing mail provider.
  4. Setup a mail forwarder to forward *@reply.my-discourse-site.com to my.discourse.site@gmail.com
  5. Change reply to replies+%{reply_key}@reply.my-discourse-site.com
11 Likes

In this case the sub-domain reply.my-discourse-site.com can use a completely different provider and setup when compared to the domain my-discourse-site.com.
So you “could” use any standard hosting just for MX mail exchange (receipt) on just that sub-domain.

If you are actually paying for “Google Apps for Work” (not the legacy free edition of Google Apps) you can configure mail to forward (to the free Gmail account) for free.

You don’t even need a sub-domain so instead of:
replies+%{reply_key}@reply.my-discourse-site.com
you could go with:
replies+%{reply_key}@my-discourse-site.com

  1. Login as a domain admin https://admin.google.com/
  2. Select “Apps” >“Google Apps” > “Gmail”
  3. Select “Advanced settings >” (near the bottom)
  4. Select “Default routing” at the top
  5. Select “Add Setting”
  6. Setup the setting as follows:

    That regular expression is ^replies\+[^@]+@
    If you have multiple domains in your Google Apps for Work account you might want to include the domain qualifier on the end of that expression (remember to escape you periods \.)
  7. Save

That will then forward that mail elsewhere for free without requiring payment for an additional Google Apps for Work user.

11 Likes

No, I think you still want two separate settings. The reply by email address is the template that will be used to generate the return address on outgoing mail, and alternative reply by email addresses is for any other addresses you want recognised as reply addresses for incoming e-mail. As @pfaffman said, you use the alternatives list when you change addresses for some reason, and don’t want new replies people make just after the switch (which will go to the old address, the one that was in the mail they received) to be thrown out.

8 Likes

As a note, if you have two factor authentication enabled, you can generate an App password for discourse and use it in the Discourse pop3 email password setting without having to enable the Access from less secure apps option in GMail.

7 Likes

Taking a look, the Rails application boot configuration paradigm is incompatible with Discourse’s multisite-friendly, runtime reconfigurable SiteSettings system. It’s unlikely that Discourse will be switching.

6 Likes