Tip: unsubscribing from GitHub notifications from within mutt

Sébastien Hinderer Sebastien.Hinderer at ens-lyon.org
Tue Sep 12 14:07:44 UTC 2023


Dear all,

Here is something I have been wanting for a long time.

For those who don't know, the email notifications sent by GitHub do have
all the information to unsubscribe from the corresponding thread in
their header, not only as the href of a link of their HTML attachment.

This little script, stored as ~/bin/github-unsubscribe, extracts the
unsubscription URL from the email header andpasses it to curl, which is
enough to be unsubscribed, no Javascript is required for this to work.
Here is the script:

```

#!/bin/sh
# Unsubscribe from a GitHub notification
url=`grep https://github.com/notifications/unsubscribe/ - | \
sed -e 's/<//g' -e 's/>//g'`
curl -s $url > /dev/null 2>&1
```

And then the mutt macro to invoke that script from the index  and pager:

# Unsubscribe from GitHub notifications

macro index,pager "," "<pipe-message>github-unsubscribe\n" "Unsubscribe from GitHub notifications"

Enjoy,

Seb.


More information about the Mutt-users mailing list