Reporting

How to enable HTML formatting or tags in an email message generated with the sendemail command?

joshschwarz
Engager

I have a system set up where I am using map with sendemail to email out notifications (which is working fine). However I now want to add company branding into the email through using our HTML formatted template. I can't for the life of me get Splunk to recognize html tags even with content_type=html.

A simple test I have been trying to get working is as follows:

| sendemail content_type=html to=me@company.com subject="TEST" from=splunk@localhost footer=. message="<b>HELLO </b> This is a test"

With the above, the email comes through fine, I just get a literal string with no formatting applied. I have tried different encodings (URL, Base64), and escaping so far, but couldn't think of much else! I don't want anything too fancy, and would prefer not to roll my own sendemail.py if it can be avoided.

niketn
Legend

Splunk sends email message as plain-text. The content_type=html is for formatting of other contents set by Splunk like link to alerts, inline table with tabular formatting etc. This will in fact prevent malicious content to be embedded via message content as html.

Having said that please try to send message with email address and web URL which should get auto formatted. Also \n should get formatted as new line. This might work in Outlook with Auto Formatting turned on, however, behavior for Desktop App and Web App may vary and would need testing. Try changing content_type between html and plain for triggering alerts and check in both Desktop and Web App.

| sendemail content_type=html to=me@company.com subject="TEST" message="This is a test. \n Email To: email@comapny.com Link: http:\\localhost:8000 "

Also ideally footer should be modified to add signature. However, directly no formatting can be done on footer and you will have to rely on modifying sendemail.py for complete control of the email.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

snoobzilla
Builder
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...