[ZBXNEXT-517] Mail text as plain/HTML, only on demand Created: 2010 Sep 22  Updated: 2024 Apr 10  Resolved: 2019 Mar 20

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S)
Affects Version/s: 1.8.2
Fix Version/s: 4.2.0alpha1, 4.2 (plan)

Type: Change Request Priority: Minor
Reporter: Anthony Assignee: Michael Veksler
Resolution: Fixed Votes: 42
Labels: alerts, email, html, usability
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified
Environment:

Zabbix 1.8.2 (FreeBSD port)


Attachments: PNG File html.png    
Issue Links:
Causes
causes ZBX-15840 Default email message is displayed in... Closed
Duplicate
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ZBXNEXT-4853 Frontend for Mail text as plain/HTML,... Change Request (Sub-task) Closed Vasily Goncharenko  
Team: Team A
Sprint: Sprint 45, Sprint 46, Nov 2018, Sprint 50 (Mar 2019)
Story Points: 1

 Description   

Need one small but useful improvement.

Looking for posibility of sending email messages in a "plain/html" format.

Description: if a text email message begins with the tag <html>, this tag does not appear, but such a letter should be treated as html code. And in this message should be processed all occurrences of the html tags.



 Comments   
Comment by Anthony [ 2010 Sep 22 ]

need an expandable scheme with posibility to add and use original HTML tags (if needed), like:

<b></b>
<u></u>
<i></i>
<hr>
<mail></mail>
<font color></font>
<br>

Comment by Anthony [ 2010 Nov 25 ]

Additional information:

NO <br> tags are required for text formatting.

Need only put <pre> tag BEFORE of message and </pre> AFTER.

This completely saves all linebreaks.

Comment by Robert Hau [ 2011 Aug 31 ]

Having HTML Email capability would be great. I have wanted to enable automatic emails to be sent to our clients, but we required it to be formated properly.

Comment by romale [ 2013 Oct 07 ]

for example, in action should be parameter something: "INSERT HTML CODE" or "HTML CODE". After, we can create html message in LibreOffice, insert zabbix macros keys and paste this html source to action.
Most customers whants it own corporate standard message form. So technical support or zabbix owner can receive plain text messages, and business users can receive html formatted

Comment by Oleksii Zagorskyi [ 2015 Apr 27 ]

It could also help to workaround a specific Outlook behavior (removing line breaks in plain text mail by default).
https://support.microsoft.com/en-us/kb/287816

Comment by Vitaly Zhuravlev [ 2016 Sep 19 ]

As a workaround:
I've been using a small change in a source code before compiling zabbix since 1.6 without any issues:

I've been constantly changing one single line in src/libs/zbxmedia/email.c

	tmp = zbx_dsprintf(tmp,
			"From: %s%s\r\n"
			"To: %s%s\r\n"
			"Date: %s\r\n"
			"Subject: %s\r\n"
			"MIME-Version: 1.0\r\n"
			"Content-Type: text/plain; charset=\"UTF-8\"\r\n"
			"Content-Transfer-Encoding: base64\r\n"
			"\r\n"
			"%s",
			NULL != from_display_name ? from_display_name : "", from_angle_addr,
			NULL != to_display_name ? to_display_name: "", to_angle_addr,
			str_time, localsubject, localbody);

to

	tmp = zbx_dsprintf(tmp,
			"From: %s%s\r\n"
			"To: %s%s\r\n"
			"Date: %s\r\n"
			"Subject: %s\r\n"
			"MIME-Version: 1.0\r\n"
			"Content-Type: text/html; charset=\"UTF-8\"\r\n"
			"Content-Transfer-Encoding: base64\r\n"
			"\r\n"
			"%s",
			NULL != from_display_name ? from_display_name : "", from_angle_addr,
			NULL != to_display_name ? to_display_name: "", to_angle_addr,
			str_time, localsubject, localbody);

This actually allowed me to color-code problems with RED against GREEN for recoveries
And to use clickable links to Zabbix and Ticketing system:

And that didn't break my plain text alerts (for SMS for instance) if I wanted to use them at the same time.

And IMHO, text/html could be a default for Zabbix without any serious consequences.

Comment by Alexey Korepov [ 2017 Feb 17 ]

Before this issue is solved - here we can find some workarounds for this problem via external scripts:
https://blog.keios.eu/note/html-e-mails-zabbix
http://va0816.blogspot.ru/2013/07/zabbix-htmlmail.html
http://wordpress.jpcorp.eti.br/?p=545

Comment by Michael Veksler [ 2018 Nov 27 ]

Available in 4.2.0alpha1 (trunk) r87279.

Generated at Wed Apr 30 07:00:17 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.