You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Achim D. Brucker b77edac00f Fixed typo. 1 year ago
LICENSE Clarified copyright. 4 years ago
Pipfile Initial commit. 4 years ago
Pipfile.lock Initial commit. 4 years ago Fixed typo. 1 year ago
unsanitize-safelinks Updated regexp for matching Britisch and Amercian spelling. 3 years ago

Unsanitize Safelinks: A Utility for Microsoft's Safelinks

Both the home/personal online offerings of Microsoft Outlook (e.g.,, Office 365 Home, or Office 365 Personal) and the professional Office 365 offerings (e.g., as part of Office 365 Advanced Threat Detection) might rewrite links in received emails with the goal of protecting users against certain threats (e.g., phishing).

For various reasons, one might to rewrite these "safelinks" back into their original form. The script unsantize-safelinks does exactly this. This can, for example, be used for displaying mails nicely in mutt or other text-based mail programs. In your ".muttrc" you need to add/edit the following configuration:

set display_filter="unsanitize-safelinks"

If you want to also rewrite the links when using tools such as urlscan, use:

macro index,pager \cb "<pipe-message> unsanitize-safelinks| urlscan<Enter>"

And the following trick rewrites the links prior to editing a message (e.g., when replying):

set editor ="unsanitize-safelinks -i %s && $EDITOR %s"

Finally, if links should be rewritten when viewing the HTML-part, you need to edit your your ".mailcap" entry for type "text/html":

text/html; unsanitize-safelinks -i --html %s && /usr/bin/sensible-browser %s; description=HTML Text; nametemplate=%s.html



This project is licensed under a 2-clause BSD license.

SPDX-License-Identifier: BSD-2-Clause

Upstream Repository

The upstream git repository, i.e., the single source of truth, for this project is hosted by the Software Assurance & Security Research Team at