sensu / sensu-email-handler

Sensu Go Email Handler Plugin
https://sensu.io
MIT License
11 stars 17 forks source link

Unable to send HTML emails #70

Open MichaelCharles opened 2 years ago

MichaelCharles commented 2 years ago

sensu-backend is running on Ubuntu 20.04 sensu-agent is running on Windows Server 2019


I tried some simple HTML content, like so.

<html><head><style>p {color: red;}</style></head><body><h1>This was a triump.</h1><p>I'm making a note here: Huge success.</p></body></html>

It successfully uses the template, but it is sent as plaintext.

I also tried copy/pasting the template that is available in the documentation, and that also resulted in just plain text.

The following is an example of what I'm receiving as an email.

MichaelCharles commented 2 years ago

Seems like it might have to do with the email provider we're using? Maybe?

We're using Sakura Internet as our email provider. And Sensu is using it to send emails to other accounts using Sakura email.

If I send an HTML email from Gmail to a Sakura email account, the HTML styles show up. You can't see any HTML tags.

If I use Sensu to send an email from a Sakura mail account to another Sakura mail account, the HTML styles do not show up and they display in plain text.

However, if I use an email client to send an HTML Email from a Sakura mail account, the HTML styles do show up and you can't see any HTML tags.

It's weird.

MichaelCharles commented 2 years ago

Actually, it seems like it is a problem with Spark?

Or at the very least I've only been able to reproduce the problem when using the Spark client for MacOS.

MichaelCharles commented 2 years ago

Here is a raw version of the email being generated (I changed some names/ids to protect sensitive information)

Return-Path: <sensu@example.com>
Received: from abcd123.sakura.ne.jp (abcd123.sakura.ne.jp [133.242.250.114])
    by www9999x.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 26Q24vXe005788
    for <michael@example.com>; Tue, 26 Jul 2022 11:04:57 +0900 (JST)
    (envelope-from sensu@example.com)
Received: from www9999x.sakura.ne.jp (49.212.168.72)
 by abcd123.sakura.ne.jp (F-Secure/fsigk_smtp/550/abcd123.sakura.ne.jp);
 Tue, 26 Jul 2022 11:04:57 +0900 (JST)
X-Virus-Status: clean(F-Secure/fsigk_smtp/550/abcd123.sakura.ne.jp)
Received: from localhost (l200068.ppp.asahi-net.or.jp [218.219.200.68])
    by www9999x.sakura.ne.jp (8.15.2/8.15.2) with ESMTPS id 99X99xXx009999
    (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO)
    for <michael@example.com>; Tue, 26 Jul 2022 11:04:56 +0900 (JST)
    (envelope-from sensu@example.com)
Message-Id: <202207260204.99X99xXx009999@www9999x.sakura.ne.jp>
From: <sensu@example.com>
To: michael@example.com
Subject: Sensu Alert - (default) TestEntity/monkey-status-check: failing
Date: Tue, 26 Jul 2022 11:04:56 +0900
Content-Type: text/html

<html>
<head>
<style>
p {
    color: red;
}
</style>
</head>
<body>
<p>This is a test.</p>
</body>
</html>