Search code examples
remailoutlookmsg

Extracting headers of msg outlook emails exported from "Sent folder" using msgxtractr package in R


Using the msgxtractr package on R, I am trying to extract the headers of outlook emails with the format ".msg". The codes used are:

path = "C:/Users/.../email_for_extracting.msg"
library(msgxtractr)
email = read_msg(path)
email_header = email$headers

However, I notice that I am only able to do so if the email is located in the "Inbox" folder of my Outlook in the first place, and thereafter exported as a msg file. If the email is saved from the "Sent" folder, then email_header will be NULL.

Is there a way to extract the headers of emails located in the "Sent" folder of my Outlook? Thank you!


Solution

  • Sent messages do not have the PR_TRANSPORT_MESSAGE_HEADERS MAPI property - it is only present on received messages when Outlook parses incoming messages and extracts the MIME headers. Sent messages might not even be converted to MIME, e.g. when sending between two Exchange mailboxes. Take a look at the messages with OutlookSpy (I am its author) - click IMessage button to see the available MAPI properties.