在 Discourse 中镜像只读邮件列表

:bookmark: This guide explains how to create a read-only mirror of a mailing list using Discourse. It covers the necessary site settings, category configuration, and subscription process.

:person_raising_hand: Required user level: Administrator

Discourse can function as an archive for a mailing list while allowing registered users to utilize most of its features. This guide will walk you through the process of setting up your own mailing list mirror.

:eyes: See this in our action on the Ruby-Talk mailing list mirror.

Summary

  • Configure site settings for email handling
  • Create or modify a category for the mailing list
  • Subscribe to the mailing list
  • Understand how the mirroring process works

The following guide uses two email addresses as placeholders. You need to replace them with your actual addresses.

discourse@example.com is address for incoming emails on your Discourse
mailing-list@foo.test is the submission address of the mailing list[1]

Configuring site settings

  1. If you’re not on a hosting plan that pre-configures incoming email, set up POP3 polling or manual polling via API for the account associated with your Discourse email address (e.g., discourse@example.com).

  2. Enable the following site settings:

    • email_in: Allow incoming emails
    • enable_staged_users: Enable staged users (crucial for the mirroring process)
  3. Optional settings:

    • Set authorized_extensions to * or add specific file extensions to allow the attachment types you need
    • Enable always_show_trimmed_content to allow all users to see trimmed content (hidden behind a image button)
    • Enable display_name_on_posts and disable prioritize_username_in_ux for name display preferences

Creating or modifying a category

  1. Create a new category or edit an existing one for the mailing list posts.

  2. Configure category permissions:

    • Click the “Security” tab, then “Edit Permissions”
    • Remove all existing permissions
    • Add “everyone” with “See” permission

When you’re done, it should look like this:

  1. Configure category settings:

    • Click the “Settings” tab
    • Enable “Accept emails from anonymous users with no accounts”
    • Set “Custom incoming email address” to the mailing list’s email address (e.g., mailing-list@foo.test)
    • Enable “Category mirrors mailing list”
  2. Save the category settings.

Subscribing to the mailing list

  1. Subscribe to the mailing list using your Discourse email address (e.g., discourse@example.com).

  2. If the mailing list has a web interface, ensure the following settings:

    • Mail delivery is enabled
    • Digest mode is off
    • Password reminder emails are disabled

For Mailman 2, make sure:

  • “Mail delivery” is “Enabled”
  • “Set Digest Mode” is “Off”
  • “Get password reminder email for this list?” is set to “No”

How it works

Enabling “Category mirrors a mailing list” changes how incoming emails are processed for that specific category:

  • Auto-generated emails are allowed, even when block_auto_generated_emails is enabled
  • All users can post via email, ignoring the email_in_min_trust setting
  • Incoming emails use the Message-ID to find related posts, regardless of the find_related_post_with_key setting
  • Markdown interpretation is limited to code blocks enclosed in triple backticks
  • Rejection emails are not sent for mailing list posts

FAQs

Q: Can I mirror multiple mailing lists?
A: Yes, create a separate category for each mailing list and configure them as described above.

Q: Can users reply to notifications and post to the mailing list?
A: No, replies to notifications are sent to Discourse, not the original mailing list. Users cannot post directly to the mailing list through Discourse.

Q: How can I prevent users from posting to the mirrored category via email?
A: While the category allows email posting, you can keep the incoming email address private to prevent unauthorized posting.


  1. i.e. people send to this address to post to the list, and it also appears on the To:/CC: lines of emails sent by the list to members ↩︎

Last edited by @supermathie 2024-10-18T20:01:40Z

Check documentPerform check on document:
31 个赞

这是否意味着“如果任何用户知道传入的电子邮件地址,他们就可以发布到此类别”?可以通过_不将该地址告知任何人_来阻止这种情况,对吗?

但是,假设如果有人通过电子邮件收到通知,他们可以回复。该回复是作为帖子发送到 Discourse,还是发送到邮件列表?

2 个赞

这些是很好的问题。

是的,我认为如果他们知道传入的电子邮件地址并且伪造了“发件人”地址,使其与邮件列表地址匹配,那么就有可能做到。

我想说不行,但我对此不完全确定。所以,也许可以。请尝试一下并告诉我。有可能这也需要伪造发件人地址。

它肯定会发送到 Discourse。

3 个赞

我有一个网站,它将一个 Google 群组转发到一个类别,其中设置了“接受来自匿名用户的电子邮件”和“镜像邮件列表”,但它仍然因“Email::Receiver::UserNotFoundError”而拒绝邮件。

还有什么可能触发此问题吗?

2 个赞

您是否启用了分阶段用户?

4 个赞

不。分阶段用户已关闭。所以我想它必须开启才能工作?(这说得通……)那么,在您尝试启用它时,是否应该有一个检查?

2 个赞

我不确定,但这是我最好的猜测。

编辑:这里有一个唯一的地方会引发此错误,它看起来像这样:

raise UserNotFoundError unless SiteSetting.enable_staged_users

4 个赞

I’ll have to try it out, but my assumption is that quite a few people will try to reply. It might be nice to have one or more of these options:

  1. Don’t send mail even if someone is watching this category. Possibly give them a notification (or a one-time message) saying that if they want email delivery of this list, they should {do whatever steps it takes to sign up for the list directly}.

  2. Let the site admin define the reply-to address when mail is sent from a mailing-list-mirror category. (On a per category basis, of course.) Then, users could subscribe to that list without delivery enabled, get notifications from Discourse, and if they reply, that reply would actually go to the original list.

  3. A “divert replies to category” option, where when someone replies, a linked topic is created in a different category. For example, category Announce List is a mailing list mirror, and then Discussion About The Announcements for replies. The title needs some workshopping. :slight_smile:

3 个赞

@gerhard,指南是否清楚地说明了这一点?

3 个赞

不,它没有,但现在有了。

5 个赞

谢谢!这之前让我很困惑,因为我以为这里的特殊处理也以某种方式特殊处理了分阶段的用户(可能只为发布到此类别而创建它们?)。

4 个赞

是否可以通过在 Discourse 上创建一个属于 Google Group 的帐户来实现双向通信?然后,论坛帖子将发送到 GG,就像它是电子邮件列表上的另一个用户一样(我们需要拒绝该用户的所有传入邮件以避免循环)。我之所以这样问,是因为我想在用户迁移过程中同时运行 Discourse 和 GG。

我正在成功镜像一个 Google Group 邮件列表,但它不识别主题回复。我最终会收到 Google Topic 1 的帖子,然后是单独的 Re: Google Topic 1。有没有办法让它识别主题线程?