Discussion
MS Graph API returns mail message body as HTML code instead of plain text
Hi All,
We have done following steps successfully:
a) Email account connectivity for receiver via MS Graph API.
b) Email listener is up and running using email account for reading email via MS Graph API
c) work case is getting created using email listener
Issue observed:
Email body is appeared in html format instead of text format.
Though we have configured format as text in email listener. Also in request form in Service Email rule HTML Body message is configured as "inline-text"
While checking online got below link:
https://stackoverflow.com/questions/51491794/microsoft-graph-api-returns-mail-message-body-as-html
above link suggests below setting:
requestMessage.Headers.Add("Prefer", "outlook.body-content-type='text'");
How to add above setting in Service email form in header fields . I can see some options in help article but not clear instructions on it.
Please share your thoughts if you have seen similar issue and you have some ideas/solution for this.
.
Root cause description:
A defect in Pegasystems’ code or rules
MSGraph provides html content of message as default content when we retrieve message data. Need to use Prefer: outlook.body-content-type="text" header to get message without html tags which is currently missing in Product.
Wioth the fix note that there will still be a difference between the message contents retrieved from a message using IMAP and graph
In case of processing a MIME message having an alternative part containing PLAIN TEXT PART and HTML TEXT PART with DIFFERENT body(content)
Using IMAP We can retrieve content of BOTH plain text part and html text part and process the corresponding content as per configuration on Service Email .
Using GRAPH Although we use the header mentioned above it just REMOVES the html tags in data present in HTML PART and provide message content and there is no way to retrieve data of PLAIN TEXT PART. It is limitation of MSGRAPH
Solution description: This issue is addressed in 8.4.3