Fixed error not sending the email.
This commit is contained in:
1 parent
f7161f0302
commit
96a99e3d6d
1 file changed
+4
-4
@@ -90,11 +90,11 @@ CheckSchema.pre("save", async function (next) {
|
|||||||
if (monitor.status === true && this.status === false) {
|
if (monitor.status === true && this.status === false) {
|
||||||
// Notify users that the monitor is down
|
// Notify users that the monitor is down
|
||||||
for (const notification of notifications) {
|
for (const notification of notifications) {
|
||||||
if (notification.email) {
|
if (notification.type === "email") {
|
||||||
await emailService.buildAndSendEmail(
|
await emailService.buildAndSendEmail(
|
||||||
"serverIsDownTemplate",
|
"serverIsDownTemplate",
|
||||||
{ monitorName: monitor.name, monitorUrl: monitor.url },
|
{ monitorName: monitor.name, monitorUrl: monitor.url },
|
||||||
notification.email,
|
notification.address,
|
||||||
`Monitor ${monitor.name} is down`
|
`Monitor ${monitor.name} is down`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -104,11 +104,11 @@ CheckSchema.pre("save", async function (next) {
|
|||||||
if (monitor.status === false && this.status === true) {
|
if (monitor.status === false && this.status === true) {
|
||||||
// Notify users that the monitor is up
|
// Notify users that the monitor is up
|
||||||
for (const notification of notifications) {
|
for (const notification of notifications) {
|
||||||
if (notification.email) {
|
if (notification.type === "email") {
|
||||||
await emailService.buildAndSendEmail(
|
await emailService.buildAndSendEmail(
|
||||||
"serverIsUpTemplate",
|
"serverIsUpTemplate",
|
||||||
{ monitorName: monitor.name, monitorUrl: monitor.url },
|
{ monitorName: monitor.name, monitorUrl: monitor.url },
|
||||||
notification.email,
|
notification.address,
|
||||||
`Monitor ${monitor.name} is back up`
|
`Monitor ${monitor.name} is back up`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user