Automatically Unsubscribe from Newsletters in Gmail

The bulk email messages in Gmail have an “unsubscribe” link that you can click to remove your email address from the mailing list. However, if you wish to unsubscribe from multiple email newsletters in one go, you can use the Gmail Unsubscriber script.

Apply the label “Unsubscribe” to all the emails from which you wish to unsubscribe and call this apps script. It extracts the unsubscribe link from the raw message header and fetches the link to unsubscribe you. Press Cmd+Enter to see the list of all mailing lists from which you have been unsubscribed.

Joshua Peak has done the groundwork but it only works if the email message contains the unsubscribe link in the List Unsubscribe header.

I extended this to unsubscribe from mailing lists where the link may be in the message body or messages that may require your to unsubscribe by sending an email to a specific email address.