Safelinks in Outlook 365 are horrendous. Is there a reason why they put the full link into the text body?
I mean, is there a reason they aren't like this:
<html>
<head />
<body>
<a href="https://aus01.safelinks.protection.outlook.com/">https://www.originallink.com/</a>
</body>
</html>
so you can parse the original link whilst still being 'protected'? Is there a option to display them like this, rather than just turning off Safelinks altogether?
You can develop VBA macro or COM add-in where you could replace hyperlinks with your own format. For that you need to handle the
NewMailEx
event of the OutlookApplication
class which is fired for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example,MailItem
,MeetingItem
, orSharingItem
. TheEntryIDsCollection
string contains the Entry ID that corresponds to that item.The
NewMailEx
event fires when a new message arrives in the Inbox and before client rule processing occurs. Use the Entry ID returned in theEntryIDCollection
string to call the NameSpace.GetItemFromID method and process the item.In the event handle you have access to the
HTMLBody
property where you can find all hyperlinks and do the required replacements.