mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-04-02 06:22:20 +00:00
Merge f7f224bc34
into fce824f5a8
This commit is contained in:
commit
90dcb1a9b2
2 changed files with 13 additions and 2 deletions
|
@ -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 useHTMLBody = false;
|
||||
if (heartbeatJSON) {
|
||||
body = `${msg}\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`;
|
||||
}
|
||||
|
@ -52,7 +53,6 @@ class SMTP extends NotificationProvider {
|
|||
// cannot end with whitespace as this often raises spam scores
|
||||
const customSubject = notification.customSubject?.trim() || "";
|
||||
const customBody = notification.customBody?.trim() || "";
|
||||
|
||||
const context = this.generateContext(msg, monitorJSON, heartbeatJSON);
|
||||
const engine = new Liquid();
|
||||
if (customSubject !== "") {
|
||||
|
@ -60,6 +60,7 @@ class SMTP extends NotificationProvider {
|
|||
subject = await engine.render(tpl, context);
|
||||
}
|
||||
if (customBody !== "") {
|
||||
useHTMLBody = notification.htmlBody || false;
|
||||
const tpl = engine.parse(customBody);
|
||||
body = await engine.render(tpl, context);
|
||||
}
|
||||
|
@ -73,7 +74,8 @@ class SMTP extends NotificationProvider {
|
|||
bcc: notification.smtpBCC,
|
||||
to: notification.smtpTo,
|
||||
subject: subject,
|
||||
text: body,
|
||||
// If the email body is custom, and the user wants it, set the email body as HTML
|
||||
[useHTMLBody ? "html" : "text"]: body
|
||||
});
|
||||
|
||||
return okMsg;
|
||||
|
|
|
@ -89,6 +89,15 @@
|
|||
<div class="form-text">{{ $t("leave blank for default body") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input id="use-html-body" v-model="$parent.notification.htmlBody" class="form-check-input" type="checkbox" value="">
|
||||
<label class="form-check-label" for="use-html-body">
|
||||
{{ $t("Use HTML for custom E-mail body") }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ToggleSection :heading="$t('smtpDkimSettings')">
|
||||
<i18n-t tag="div" keypath="smtpDkimDesc" class="form-text mb-3">
|
||||
<a href="https://nodemailer.com/dkim/" target="_blank">{{ $t("documentation") }}</a>
|
||||
|
|
Loading…
Add table
Reference in a new issue