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