changed smtp to allow for html bodies

This commit is contained in:
youpie 2025-02-19 23:37:13 +01:00
parent b45dc6787d
commit acb99487f8
No known key found for this signature in database

View file

@ -44,6 +44,7 @@ class SMTP extends NotificationProvider {
// default values in case the user does not want to template
let subject = msg;
let body = msg;
let use_html_body = false
if (heartbeatJSON) {
body = `${msg}\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`;
}
@ -52,7 +53,7 @@ class SMTP extends NotificationProvider {
// cannot end with whitespace as this often raises spam scores
const customSubject = notification.customSubject?.trim() || "";
const customBody = notification.customBody?.trim() || "";
use_html_body = notification.htmlBody || false
const context = this.generateContext(msg, monitorJSON, heartbeatJSON);
const engine = new Liquid();
if (customSubject !== "") {
@ -73,7 +74,7 @@ class SMTP extends NotificationProvider {
bcc: notification.smtpBCC,
to: notification.smtpTo,
subject: subject,
text: body,
[htmlBody ? 'html' : 'text']: body
});
return okMsg;