I have configured an Outlook Add In using Office.js that hooks in to the ItemSend event in order to modify an email body prior to sending the email. The add in was configured (yesterday) using the
npm install -g yo generator-office yo office
I modified this slightly to add a function that handles the
<Hosts> <Host xsi:type="MailHost"> <DesktopFormFactor> <FunctionFile resid="Commands.Url" /> <ExtensionPoint xsi:type="Events"> <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="validateBody" /> </ExtensionPoint> ...
The add in is functioning as expected on the Outlook Web version and on Outlook Desktop, When I send an email from the outlook desktop app, I can see that my code is running as expected.
Interestingly, Hubspot's add in apparently runs successfully when sending mail this way (Mail Merge from Microsoft Word), and they are able to modify the email body (re-write links and add tracking pixel) for each email that gets sent out. So it should be possible, but I'm not sure what integration point is needed, or how they are achieving it.
Any pointers in the right direction would be greatly appreciated.