Sure. The headers Discourse currently sets look like this (from an actual notification from this thread):
List-Unsubscribe: <https://meta.discourse.org/email/unsubscribe/efed8ca1777379c660afc031464b98eb4e6fa2323a71fa12fa2269eeca5b0905>
X-Discourse-Post-Id: 1216779
X-Discourse-Topic-Id: 249982
X-Auto-Response-Suppress: All
Auto-Submitted: auto-generated
Precedence: list
List-ID: Discourse Meta | feature <feature.meta.discourse.org>
List-Archive: https://meta.discourse.org/t/headers-for-email-notifications-so-that-gmail-users-can-filter-on-tags/249982
Feedback-ID: meta:user_replied:discoursemail
If it weren’t for Gmail, adding something like:
X-Discourse-Tags: some-tag, another-tag
See Customs email headers and/or subjects tags - #6 by mattdm — if the email custom headers
setting were passed through template expansion so X-Discourse-Tags: %{optional_tags}
worked, this part would work already.
And, for procmail and other old-school email client users, this would be sufficient. Unfortunately, for whatever inscrutable Google reasons, Gmail can’t filter on arbitrary tags, and is (as far as I know) limited to To:
, From:
, Cc:
and … fortunately at least, List-ID
. Since that’s the 800-lb gorilla, to accommodate those users, setting List-ID
by tag instead of category (or, in combination?) is the best I can think of.
However, RFC 2919 says that only one List-ID
is permitted per message. So that leaves::
- Pick one tag arbitrarily[1]
- Generate something including all tags, like
List-ID: firsttag_secondtag.discourse.example.org
and let users figure that out. [2] - Generate multiple emails per notification, one for each tag and differing only in this header[3]
- Leave List-ID referring to category, and instead use the CC idea… [4]
I don’t really love any of those. So as a first pass, X-Discourse-Tags:
would at least cover the non-gmail users. (Which is probably a pretty good overlap with web-resistant users, so I think worth doing to see how far that gets us.)