Showing labels and tagging emails

35 views
Skip to first unread message

jman

unread,
May 12, 2025, 4:58:44 AMMay 12
to mu-discuss

Hey,

I'm opening probably the nth thread about tagging/labelling emails, sorry about that.
I receive a lot of emails from GitHub, I'd like to visually sort them by priority.

The rules are based on reading the X-GitHub-Recipient: gh-handle
Look at the =X-GitHub-Reason= header and filter/tag emails accordingly.


https://borrowed.dev/p/using-fastmail-email-rules-and-labels

jman

unread,
May 12, 2025, 5:07:02 AMMay 12
to 'jman' via mu-discuss

(Apologies for my previous messed up email, I pressed the "send" keycombo while formatting the
text).

---

Hi everyone,

I'm opening probably the nth thread about tagging/labelling emails, sorry about that.
I receive a lot of emails from GitHub, I'd like to visually sort them by priority.

The rules are based the "X-GitHub-Recipient: gh-handle" and the "X-GitHub-Reason" headers.
I'd like to implement what is described in this blog post:
https://borrowed.dev/p/using-fastmail-email-rules-and-labels

I can apply some filtering on the MTA (I use "maildrop"), is it the right way to do that? Should I
instead create some "views" in mu4e?
I think I need some suggestions on where to start to do that, I couldn't find (or I missed) in the
documentation a starting point.

Thanks!

Best,

Dirk-Jan C. Binnema

unread,
May 14, 2025, 2:19:19 AMMay 14
to mu-di...@googlegroups.com
On Monday May 12 2025, 'jman' via mu-discuss wrote:

> I'm opening probably the nth thread about tagging/labelling emails, sorry about that.
> I receive a lot of emails from GitHub, I'd like to visually sort them by priority.
>
> The rules are based the "X-GitHub-Recipient: gh-handle" and the "X-GitHub-Reason" headers.
> I'd like to implement what is described in this blog post:
> https://borrowed.dev/p/using-fastmail-email-rules-and-labels
>
> I can apply some filtering on the MTA (I use "maildrop"), is it the right way to
> do that? Should I instead create some "views" in mu4e?
> I think I need some suggestions on where to start to do that, I couldn't find
> (or I missed) in the documentation a starting point.

mu doesn't support searching arbitrary mail headers, such as those
github ones; however, you could do something with some other program
like procmail (and perhaps maildrop?) to turn these fields into tags
("X-Label:", ""X-Keywords:") which mu does support.

Or perhaps filter them into different maildirs (with maildrop/procmail),
if that has enough granularity.

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036

jman

unread,
May 19, 2025, 3:56:12 PMMay 19
to Dirk-Jan C. Binnema, mu-di...@googlegroups.com
"Dirk-Jan C. Binnema" <dj...@djcbsoftware.nl> writes:

> mu doesn't support searching arbitrary mail headers, such as those
> github ones; however, you could do something with some other program
> like procmail (and perhaps maildrop?) to turn these fields into tags
> ("X-Label:", ""X-Keywords:") which mu does support.

thanks for the tip. Luckily I have my own Postfix and I could add a few Sieve rules to add custom
headers server-side.

So, for reference and clarification:
- The "X-priority" header can be filtered with "prio:"
- The "X-Label" and "X-Keywords" headers can be filtered with "tags:"

(though I couldn't find an explicit mention of the latter in the documentation or man 7 mu-query)

Just to understand the context better: how complicated would it be to teach mu to search /any/
X-custom header? Would it make the size of the search index explode?

Oh, speaking of documentation, https://djcbsoftware.nl/code/mu/mu4e/index.html is slightly behind,
shows docs for 1.12.8

Two notes, for the occasional reader:
- maildrop does not have anything to edit emails (injecting headers for example)
- procmail is IIUC outdated and basically abandoned, its use is discouraged

Thanks!

Dirk-Jan C. Binnema

unread,
May 21, 2025, 7:10:24 AMMay 21
to mu-di...@googlegroups.com
On Monday May 19 2025, 'jman' via mu-discuss wrote:

> "Dirk-Jan C. Binnema" <dj...@djcbsoftware.nl> writes:
>
>> mu doesn't support searching arbitrary mail headers, such as those
>> github ones; however, you could do something with some other program
>> like procmail (and perhaps maildrop?) to turn these fields into tags
>> ("X-Label:", ""X-Keywords:") which mu does support.
>
> thanks for the tip. Luckily I have my own Postfix and I could add a few
> Sieve rules to add custom headers server-side.
>
> So, for reference and clarification:
> - The "X-priority" header can be filtered with "prio:"
> - The "X-Label" and "X-Keywords" headers can be filtered with "tags:"
>
> (though I couldn't find an explicit mention of the latter in the documentation or man 7 mu-query)

> Just to understand the context better: how complicated would it be to
> teach mu to search /any/ X-custom header? Would it make the size of the
> search index explode?

The index size is no issue, but the indexing code only supports a number
of predefined headers; and the rest of the code (such as the query
handling) depends on this as well. I guess its a consequence of how
Xapian works. No plans to change that.

I must admit the github labels looked useful though.

> Two notes, for the occasional reader:
> - maildrop does not have anything to edit emails (injecting headers for example)
> - procmail is IIUC outdated and basically abandoned, its use is discouraged

I've been using procmail for the last 20 years of so, it works fine :-).

Alexis

unread,
May 21, 2025, 7:33:47 AMMay 21
to mu-di...@googlegroups.com
"Dirk-Jan C. Binnema" <dj...@djcbsoftware.nl> writes:
>
> On Monday May 19 2025, 'jman' via mu-discuss wrote:
>>
>> Two notes, for the occasional reader:
>> - maildrop does not have anything to edit emails (injecting
>> headers
>> for example)
>> - procmail is IIUC outdated and basically abandoned, its use is
>> discouraged
>
> I've been using procmail for the last 20 years of so, it works
> fine
> :-).

Nowadays i'm using fdm in place of getmail+procmail /
getmail+maildrop. fdm allows one to inject headers, as described
in the
fdm.conf(5) man page:

add-header name value value
Add a header name with contents value.

remove-header name

remove-headers { name ... }
Remove all occurrences of headers matching the fnmatch(3)
pattern name.

-- https://manpages.debian.org/testing/fdm/fdm.conf.5.en.html


Alexis.
Reply all
Reply to author
Forward
0 new messages