All Apps and Add-ons

Microsoft O365 Email Add-on for Splunk - is there any way to remove HTML from emails bodys?

althomas
Communicator

Hi all,

I'm looking to get a non-HTML version of the email body (like as in the email preview section) for the app Microsoft O365 Email Add-on for Splunk.
Is there anyway to do this? 
I don't need all the HTML -- can it be stripped somehow?

Example:

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style>
<!--
@font-face
	{font-family:"Cambria Math"}
@font-face
	{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif}
a:link, span.MsoHyperlink
	{color:#0563C1;
	text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
	{color:#954F72;
	text-decoration:underline}
span.EmailStyle17
	{font-family:"Calibri",sans-serif;
	color:windowtext}
.MsoChpDefault
	{font-family:"Calibri",sans-serif}
@page WordSection1
	{margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
	{}
-->
</style></head><body lang="EN-GB" link="#0563C1" vlink="#954F72"><div class="WordSection1"><p class="MsoNormal">Test email</p></div></body></html>

 

When all I want is:

Test email


Thanks!
Alex

Labels (3)
0 Karma
1 Solution

althomas
Communicator

In "input_module_o365_email.py", I added the "Prefer" key to the headers:

headers = {"Authorization": "Bearer " + access_token,
                "User-Agent": "MicrosoftGraphEmail-Splunk/" + _get_app_version(helper),
                "Prefer": "outlook.body-content-type='text'"}

 

to get the body data to be output as text.

View solution in original post

0 Karma

althomas
Communicator

In "input_module_o365_email.py", I added the "Prefer" key to the headers:

headers = {"Authorization": "Bearer " + access_token,
                "User-Agent": "MicrosoftGraphEmail-Splunk/" + _get_app_version(helper),
                "Prefer": "outlook.body-content-type='text'"}

 

to get the body data to be output as text.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...