1

According to this question Is it possible to retrieve the RFC 2822 (or any) headers from an email with the Outlook/Office 365 REST API? by doing

GET https://outlook.office.com/api/beta/me/mailfolders/inbox/messages$select=InternetMessageHeaders

But I can get the header only for inbox items, I need to retrieve the header for the sent items as well!

sarea
  • 215
  • 1
  • 13
  • Perhaps I'm misunderstanding, but I don't believe sent items have Internet headers. I attempted to view them in Microsoft Outlook and for a sent email they are blank. Thinking further, the headers typically contain the details of how the message was delivered from the sender to the recipient - which is only available at the recipient's end. The sender has no way of knowing how the message is being delivered. Please let me know if I'm incorrect or overlooking something. – Wiz Jul 03 '18 at 16:04
  • Thanks for respond, yeah actually when I think about it... it makes sense, I think it is not the actually sent mail but merely a copy of it , I thought they could still have done it though! – sarea Jul 04 '18 at 12:24

2 Answers2

1

You can get it using the $value parameter to get the MIME type of the message and read the entire header!

From Example 4 - Get message

GET https://graph.microsoft.com/v1.0/me/messages/4aade2547798441eab5188a7a2436bc1/$value

Response

HTTP/1.1 200 OK
Content-type: text/plain

Received: from contoso.com (10.194.241.197) by 
contoso.com (10.194.241.197) with Microsoft 
SMTP Server (version=TLS1_2, 
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1374.0 via Mailbox 
Transport; Mon, 4 Sep 2017 03:00:08 -0700 
Received: from contoso.com (10.194.241.197) by 
contoso.com (10.194.241.197) with Microsoft 
SMTP Server (version=TLS1_2, 
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1374.0; Mon, 4 Sep 
2017 03:00:07 -0700 
Received: from contoso.com 
(fe80::5bf:5059:4ca0:5017) by contoso.com 
(fe80::5bf:5059:4ca0:5017%12) with mapi id 15.01.1374.000; Mon, 4 Sep 2017 
03:00:01 -0700 
From: Administrator <admin@contoso.com> 
To: Administrator <admin@contoso.com> 
Subject: This email has attachment. 
Thread-Topic: This email has attachment. 
Thread-Index: AQHTJWSHSywMzSz8o0OJud48nG50GQ== 
Date: Mon, 4 Sep 2017 10:00:00 +0000 
Message-ID: 
                <4aade2547798441eab5188a7a2436bc1@contoso.com> 
Accept-Language: en-US 
Content-Language: en-US 
X-MS-Exchange-Organization-AuthAs: Internal 
X-MS-Exchange-Organization-AuthMechanism: 04 
X-MS-Exchange-Organization-AuthSource: 
                contoso.com 
X-MS-Has-Attach: yes 
X-MS-Exchange-Organization-Network-Message-Id: 
                0ffdb402-ec03-42c8-5d32-08d4f37bb517 
X-MS-Exchange-Organization-SCL: -1 
X-MS-TNEF-Correlator: 
X-MS-Exchange-Organization-RecordReviewCfmType: 0 

MIME-Version: 1.0 
Marcelo Gazzola
  • 907
  • 12
  • 28
0

The email headers are created by the email servers, these details can include who sent the message, the software that was used to compose it, and the email servers that it passed through on its way to the recipient. Hence you are not able to view the header information for the sent messages.

Viet Nguyen
  • 51
  • 1
  • 2