mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-30 18:24:03 +00:00
Add time to smtp body content
This commit is contained in:
parent
e9cd9be03a
commit
b0acda52f9
1 changed files with 8 additions and 3 deletions
|
@ -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.";
|
||||
|
|
Loading…
Reference in a new issue