Graylog2-server: Support for HTML email alerts/notifications

Created on 11 Feb 2018  路  5Comments  路  Source: Graylog2/graylog2-server

Support for HTML email alerts/notifications

Expected Behavior

Either configurable or on by default, would be helpful in formatting and general visibility of the alert. As an example, when I want to include the stream URL via ${if stream_url}${stream_url}${end}, the URL will be exceptionally long in some cases. It'd be ideal to be able to format with tags

I looked around for some stuff on this and couldnt find anything (requests, posts on community board, etc)

Current Behavior

HTML is not rendered because the email is sent with the following headers

Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Possible Solution

In https://github.com/Graylog2/graylog2-server/blob/master/graylog2-server/src/main/java/org/graylog2/alerts/FormattedEmailAlertSender.java line 171 you could use org.apache.commons.mail.HtmlEmail instead of SimpleEmail. Calling setHtmlMsg and then setTextMsg if users have configured HTML email and their clients dont support it (just an idea)

Although I am wiling to bet that this may cause issues with JMTE due to format and syntax requirements?

Steps to Reproduce (for bugs)

  1. Configure an alert/notification
  2. Use HTML in the template
  3. Send test email
  4. Observe that the email header is text/plain and HTML is not rendered

Context


Your Environment

  • Graylog Version: 2.4.0
  • Operating System: CentOS 7.4
alerting feature triaged

Most helpful comment

Graylog 3.4 released and still no HTML e-mail support for alerts... Please add it.

All 5 comments

I would like to help with this.

But using the same template (with HTML tags) to send both HTML and text emails will generate unreadable emails to those clients not supporting HTML ( u know, with all the HTML tags as part of the body...).

Maybe separate both templates? Having one for text only and one for HTML? Or trying to remove html tags from the text template (not easy, though)

Does someone has a better approach?

Graylog 3.4 released and still no HTML e-mail support for alerts... Please add it.

re-reading the last comment from 2018 makes me think that if there was a user setting of "receive HTML emails" then HTML emails could be sent to those users who have it enabled and plaintext sent to those who dont

I'm also waiting for this change eagerly. It is not possible to build convenient e-mail alerting to business users basing on plain text messages. In recent times look counts a lot.

Graylog 4 RC here and HTML mail is still missing, please add it....

Was this page helpful?
0 / 5 - 0 ratings