Skip to content

Instantly share code, notes, and snippets.

@bk2204
Created February 2, 2024 21:13
Show Gist options
  • Save bk2204/b5112d7f2bea543266f2b050cbdd5367 to your computer and use it in GitHub Desktop.
Save bk2204/b5112d7f2bea543266f2b050cbdd5367 to your computer and use it in GitHub Desktop.
A script to unsubscribe users from mailing lists
#!/bin/sh
# Pipe an email to standard input and, if it supports RFC 8058 one-click unsubscribe, you will be automatically unsubscribed.
formail -c -x List-Unsubscribe | perl -pe 's!<https?://([^>]+)>!$1!' | \
xargs curl -X POST -H'Content-Type: application/x-www-form-urlencoded' -dList-Unsubscribe=One-Click
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment