Headers for email notifications so that Gmail users can filter on tags?

The post got closed as a duplicate Email: mail headers should have tags in them, possibly in reference to Customs email headers and/or subjects tags, but the latter is kind of general, and I’d like to talk about a specific problem we have:

We’re using tags as the most-logical replacement for dozens of mailing lists about various project sub-topics. We started using categories, but that became unwieldy — categories are heavyweight, don’t allow easy cross-posting, and for a whole other number of reasons, we think tags are a better match.[1]

However… there’s a problem. While it is possible to put %{optional_tags} in the template for email notifications, Gmail’s very limited filtering doesn’t do anything smart with this — and, even for the old-school mail user it’s kind of a pain to write a procmail rule that breaks down the subject line and parses it.

So, it’d be nice to have the tag somewhere else. For the procmail folks, a custom X-Tags header would do, but Gmail won’t care, so we need something else.

One idea would be to actually use tags as List-ID, but I’m not sure Gmail does the right thing with multiple List-ID tags mutliple List-ID fields aren’t permitted [2]. Another idea, which is a bit kludgy but I think would work: put tag@subdomain.example.org (and potentially also tag2@subdomain.example.org, tag3@subdomain.example.org, …) in the CC list. Google can filter on this, and most other systems also have reasonably-advanced features for dealing with CC as a multi-value field. And, we’d redirect any mail actually sent to these addresses to the void[3].

As a bonus, the CC approach could be used as a way to add tags on incoming mail (see Add tags by email). Again, kind of kludgy, but then, so is all email, in 2022.


  1. If you’d like to discuss this, I can… in some other thread topic! ↩︎

  2. curse you, RFCE 2919! ↩︎

  3. i.e. /dev/null ↩︎

2 Likes