'Extract from an email header the Authentication-Results part using an Outlook Add-in with OfficeJS
I've been trying to the section of Authentication-Results First I tried with:
Office.context.mailbox.item.internetHeaders.getAsync
But for some reason interneHeader keeps returning undefined so I move to:
Office.context.mailbox.item.getAllInternetHeadersAsync
In my tests with Regex on it I got results from the first line of it.
But when I use it on copying email headers on regex101 or Node I got the information I need. Meaning the entire section with spf, dkim and dmarc.
I use this regex:
header.match(/^Authentication-Results:[0-9a-zA-Z =\(\)\.\n;-]*$/gm)[0]
Exemple: This is a sample of header from a Steam email:
Received: from SN1NAM02FT0054.eop-nam02.prod.protection.outlook.com
(2603:10b6:806:127:cafe::f5) by SN7PR04CA0211.outlook.office365.com
(2603:10b6:806:127::6) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend
Transport; Tue, 1 Feb 2022 20:13:03 +0000
Authentication-Results: spf=pass (sender IP is xxx.xxx.xxx.xxx)
smtp.mailfrom=steampowered.com; dkim=pass (signature was verified)
header.d=steampowered.com;dmarc=pass action=none
header.from=steampowered.com;compauth=pass reason=100
Received-SPF: Pass (protection.outlook.com: domain of steampowered.com
designates xxx.xxx.xxx.xxx as permitted sender)
receiver=protection.outlook.com; client-ip=xxx.xxx.xxx.xxx;
helo=smtp-03-tuk1.steampowered.com;
Using the my regex, on it it returns this:
Authentication-Results: spf=pass (sender IP is xxx.xxx.xxx.xxx)
smtp.mailfrom=steampowered.com; dkim=pass (signature was verified)
header.d=steampowered.com;dmarc=pass action=none
header.from=steampowered.com;compauth=pass reason=100
But when I use with Office.context.mailbox.item.getAllInternetHeadersAsync
It only returns this:
Authentication-Results: spf=pass (sender IP is xxx.xxx.xxx.xxx)
So I wanna what approach I can do to this issue?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
