设置通过POP3轮询的电子邮件回复

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 Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver

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.

Forwarding mail sent to additional addresses

Let’s say that you are polling emails from the “replies@your.domain” account and you want to setup incoming emails for “help@your.domain” and “dev@your.domain”.

You will need to forward all the emails sent to “help@your.domain” and “dev@your.domain” to “replies@your.domain”. If you are using GMail, they have a great tutorial on how to automatically forward incoming emails to another account .

Then, Discourse will periodically poll emails from the “reply@discourse.org” account and deliver the emails to the corresponding category, group, topic or message.

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.

See also: Troubleshoot reply by email

ℹ Since May 30th, 2022, the **Access from less secure apps** Google option isn't supported anymore, so you need to use app passwords, and enable the two-factor authentication to do so.

Last edited by @JammyDodger 2024-05-28T18:43:42Z

Check documentPerform check on document:
91 个赞

我明白本指南专门介绍 POP3 轮询,但我认为它应该首先推广 mail-receiver,而不是使用 Gmail 帐户,后者应该是备选方案,而不是像目前那样呈现。

我设置了各种 Discourse 安装,从未接触过 mail-receiver,因为我首先看到的是“Gmail”,然后想“我知道 Gmail,让我们来配置它”,而没有真正去了解更多,或者认为其他方式会更复杂。

我最终尝试了 mail-receiver,我认为它在各方面都是一个更好的解决方案。

Gmail 解决方案需要配置 Gmail 帐户中的应用密码,这也需要双因素身份验证。
完成所有这些工作有点麻烦,最后我们得到一个轮询率很低的回复邮件功能(而 mail-receiver 几乎是即时的)。它还依赖第三方软件。

我认为推广 mail-receiver 的另一个原因是,它不需要比安装 Discourse 本身更多的知识或技术技能。这主要是关于 DNS 和 yml 配置的问题。

当然,它比 Gmail 解决方案更具技术性(尽管我有时在尝试配置它时会感到困惑,尤其是在应用密码方面),但如果有人已经安装并配置了自托管的 Discourse,那么他们也可以安装和配置 #mail-receiver。


而且,也许更重要的是(这也是我关注它的原因),启用回复邮件设置的描述链接到本指南,而不是 mail-receiver 指南:

激活允许用户直接通过电子邮件回复主题的功能,而无需他们登录网站。有关更多信息,请参阅 Meta 上的指南

2 个赞