From 5e3ea3293c5d1f37ba65ab94182075b788608b45 Mon Sep 17 00:00:00 2001 From: Lukas <35193662+NixNotCastey@users.noreply.github.com> Date: Sat, 9 Oct 2021 20:32:45 +0200 Subject: [PATCH] Very basic email subject customization --- server/notification-providers/smtp.js | 10 +++++++++- src/components/notifications/SMTP.vue | 5 +++++ src/languages/en.js | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/notification-providers/smtp.js b/server/notification-providers/smtp.js index ecb583eb..e5fd53e4 100644 --- a/server/notification-providers/smtp.js +++ b/server/notification-providers/smtp.js @@ -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, diff --git a/src/components/notifications/SMTP.vue b/src/components/notifications/SMTP.vue index 72934cda..165d39c6 100644 --- a/src/components/notifications/SMTP.vue +++ b/src/components/notifications/SMTP.vue @@ -43,6 +43,11 @@ +
+ + +
+
diff --git a/src/languages/en.js b/src/languages/en.js index 2ce8f46b..b59cdb73 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -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",