Search by

silexlabs / flarum-mailing-list

lexoyo

Use a Flarum 2 forum like a mailing list: background email queue, every reply of followed tags by email, threaded conversations in mail clients.

Package info

github.com/silexlabs/flarum-mailing-list

Type:flarum-extension

pkg:composer/silexlabs/flarum-mailing-list

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-12-02 22:30 UTC

This package is auto-updated.

Last update: 2026-12-03 11:32:44 UTC


README

Use a Flarum 2 forum like a mailing list: read every message and answer without ever opening the website.

It does three things:

  1. Background email queue. Turns on the database queue that ships with Flarum 2, without editing config.php.
  2. Every reply of a followed tag by email. People who follow a tag with fof/follow-tags ("Following" or "Lurking") get every new post of that tag's discussions, not only the first one after their last visit. Like a mailing list: following means receiving everything.
  3. Threaded conversations. Notification emails carry stable Message-ID, In-Reply-To and References headers and one subject per discussion, so mail clients group a discussion into one conversation.

Answering by email is done by ramon/mail-reply, which this extension works with.

Requirements

  • Flarum 2.x
  • The Flarum scheduler must run every minute (php flarum schedule:run from cron or a sidecar container). Without it, jobs pile up in queue_jobs and no email is sent.
  • For feature 2: flarum/subscriptions, flarum/tags and fof/follow-tags enabled. Without them, feature 2 stays off and the rest works.

Install

composer require silexlabs/flarum-mailing-list

Enable "Mailing List" in the admin panel. There is no frontend code.

1. Background email queue

Flarum 2 only uses a real queue when config.php contains 'queue' => ['driver' => 'database']. Otherwise every notification email is sent during the request of the user who posted, which makes posting slow once many people get emails. Some setups cannot edit config.php durably, for example Docker images that regenerate it at every start (such as crazymax/flarum).

This extension rebinds the queue connection to the exact same DatabaseQueue that core builds for driver => database (table queue_jobs, created by core migrations). Core then does the rest: failed jobs go to queue_failed_jobs, the queue:* commands become available, and a queue:work --stop-when-empty task is scheduled every minute.

If config.php defines any queue driver, this part does nothing.

Check it works:

php flarum schedule:list   # shows a queue:work --stop-when-empty task
php flarum list queue      # queue:* commands are listed

2. Every reply of a followed tag by email

fof/follow-tags describes "Lurking" as "Be notified of all new discussions and replies" ("Following" only promises new discussions), but only notifies a reply to people who opened the discussion on the website and read it up to the previous post. Someone who only reads by email gets the new discussion, then nothing. In a mailing list, following means receiving every message, so this extension treats both "Following" and "Lurking" that way.

This extension fixes that with flarum/subscriptions, without changing anybody's preferences:

  • When a discussion is started (or approved, or moved to another tag), a queued job makes everyone who follows or lurks one of its tags follow the discussion (discussion_user.subscription = 'follow'). It skips the author (their own followAfterCreate preference decides), people who cannot see the discussion, people who ignore one of its tags, people who switched off both alert and email for follow-tags replies (newPostInTag), and anybody who already chose something for that discussion (following or ignoring; on a move, any existing choice including "Not following").
  • When a reply is posted, flarum/subscriptions notifies the followers of the discussion. This extension adds to that list the followers who lurk one of the discussion's tags, whatever their notify_for_all_posts preference and last read post.

"Following" a tag (as opposed to lurking) only promises new discussions, so it is not changed.

Readers can leave a discussion they are not interested in like any followed discussion: "Not following" or "Ignoring" on the website. "Ignoring" a tag stops everything for that tag.

Only discussions started or moved after the extension is enabled are followed automatically.

No duplicate emails

One post can trigger several notifications for the same person: a follow-tags reply, a subscriptions reply, a mention. Each one is its own email in Flarum. This extension sends only the first email for a given post and person (a cache lock kept 7 days) and cancels the others. Forum alerts are not changed. If sending fails, the lock is released so a retry can still deliver.

3. Threaded conversations

For notifications about a post (newPost, postMentioned, userMentioned, groupMentioned, newPostInTag, newDiscussionInTag, newDiscussionTag):

  • Message-ID: <post.{postId}@{forum host}>, the same for everyone who gets that post, like a mailing list.
  • In-Reply-To: the post being answered when known (a post mention, which ramon/mail-reply adds to every reply sent by email), otherwise the first post of the discussion. References: the first post, then the post answered.
  • Subject: {prefix} {discussion title} for the first post, Re: {prefix} {discussion title} for replies, whatever the notification type and the language of the recipient. This replaces the #{postId} suffix added by ramon/mail-reply. The Reply-To set by ramon/mail-reply is not touched.

Other emails (password reset, suspension, private discussions invitations...) are left alone.

Subject prefix

There is no settings page yet. The prefix is the setting silexlabs-mailing-list.subject_prefix, empty by default:

INSERT INTO settings (`key`, `value`)
VALUES ('silexlabs-mailing-list.subject_prefix', '[Silex]')
ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);

Add your table prefix to settings if your install uses one, then clear the cache (php flarum cache:clear).

When to remove the queue part

Once your setup lets you set 'queue' => ['driver' => 'database'] in config.php, add it there: the queue part then steps aside on its own, with the same behaviour.

License

MIT