Dashboards & Visualizations

Is there a way to add HTML markup and hyperlinks to the message field of the sendemail command?

snoobzilla
Builder

I used sendemail and map in a scheduled search and shift+enter to add linebreaks.

Is there a way to add html markup, e.g. href hyperlinks to the message field of the sendemail command and have them act like normal hyperlinks?

Thanks

0 Karma

niketn
Legend

Since Splunk sends email message as plain text, it can not have HTML content. However, if your email client has Auto Formatting turned on (for example in Microsoft Outlook Desktop App with Autoformat option turned on), then you can directly say

  your base search | sendemail content_type=html message="Splunk Alert \n Test Link: http:\\localhost:8000 .\n My Test Alert from email: someone@somewhere.com ." ...

PS: Outlook Web App I had to change content_type from html to plain, so that the Web App auto formats the content and identify @ for email and http:// for hyperlink.

Having said this, it is better to modify sendemail.py for custom formatting of email message.

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

ajitshukla61116
Path Finder

Hi @niketnilay ,
Could you please suggest me what are the changes required in sendemail.py. If we click on "Visit Dashboard" it will open dashboard, like we have "View results " in alert mail email which redirect to result of that particular alert.

here "Visit Dashboard" -->http://localhost:8000/en-US/app/myApp/last1hr.

I have tried this:

In the message body of Alert Mail configuration I have added this
Message:

Dashboard :http://localhost:8000/en-US/app/myApp/last1hr

<link>http://localhost:8000/en-US/app/myApp/last1hr </link>

Visit Dashboard

I am able to get the link and its also redirecting to desired path also but I want this link should be hidden within "Visit Dashboard" .

Please help me to find the solution of this problem.

0 Karma

woodcock
Esteemed Legend

I have not tried this but you might try making this your header:

<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<BODY>
   <H1>Hi</H1>
   <P>

And also use this as your footer:

</P> 
</BODY>
</HTML>

Then just dump it in.

0 Karma

snoobzilla
Builder

No luck so far.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...