Add time to smtp body content

This commit is contained in:
Domenic Horner 2021-09-04 11:27:18 +08:00
parent e9cd9be03a
commit b0acda52f9

View file

@ -94,7 +94,7 @@ class Notification {
}
} else if (notification.type === "smtp") {
return await Notification.smtp(notification, msg)
return await Notification.smtp(notification, msg, heartbeatJSON)
} else if (notification.type === "discord") {
try {
@ -648,7 +648,7 @@ class Notification {
await R.trash(bean)
}
static async smtp(notification, msg) {
static async smtp(notification, msg, heartbeatJSON = null) {
const config = {
host: notification.smtpHost,
@ -666,12 +666,17 @@ class Notification {
let transporter = nodemailer.createTransport(config);
let bodyTextContent = msg;
if(heartbeatJSON) {
bodyTextContent = `${msg}\nTime (UTC): ${heartbeatJSON["time"]}`;
}
// send mail with defined transport object
await transporter.sendMail({
from: `"Uptime Kuma" <${notification.smtpFrom}>`,
to: notification.smtpTo,
subject: msg,
text: msg,
text: bodyTextContent,
});
return "Sent Successfully.";