Very basic email subject customization

This commit is contained in:
Lukas 2021-10-09 20:32:45 +02:00
parent fc8d1e78b6
commit 5e3ea3293c
3 changed files with 15 additions and 1 deletions

View File

@ -20,6 +20,14 @@ class SMTP extends NotificationProvider {
pass: notification.smtpPassword,
};
}
// Lets start with default subject
let subject = msg;
// Our subject cannot end with whitespace it's often raise spam score
let customsubject = notification.customsubject.trim()
// If custom subject is not empty, change subject for notification
if (customsubject !== "") {
subject = customsubject
}
let transporter = nodemailer.createTransport(config);
@ -34,7 +42,7 @@ class SMTP extends NotificationProvider {
cc: notification.smtpCC,
bcc: notification.smtpBCC,
to: notification.smtpTo,
subject: msg,
subject: subject,
text: bodyTextContent,
tls: {
rejectUnauthorized: notification.smtpIgnoreTLSError || false,

View File

@ -43,6 +43,11 @@
</div>
</div>
<div class="mb-3">
<label for="subject-email" class="form-label">{{ $t("Custom Email subject") }}</label>
<input id="subject-email" v-model="$parent.notification.customsubject" type="text" class="form-control" autocomplete="false" placeholder="[Uptime Kuma] Service status has changed">
</div>
<div class="mb-3">
<label for="to-email" class="form-label">{{ $t("To Email") }}</label>
<input id="to-email" v-model="$parent.notification.smtpTo" type="text" class="form-control" autocomplete="false" placeholder="example2@kuma.pet, example3@kuma.pet" :required="!hasRecipient">

View File

@ -201,6 +201,7 @@ export default {
secureOptionTLS: "TLS (465)",
"Ignore TLS Error": "Ignore TLS Error",
"From Email": "From Email",
"Custom Email subject": "Custom Email Subject (leave blank for default one)",
"To Email": "To Email",
smtpCC: "CC",
smtpBCC: "BCC",