From 96a99e3d6deee6aa49fb7afc7cc7fd0ea8fe11e9 Mon Sep 17 00:00:00 2001 From: M M Date: Tue, 6 Aug 2024 20:53:42 -0700 Subject: [PATCH] Fixed error not sending the email. --- Server/models/Check.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Server/models/Check.js b/Server/models/Check.js index f617e1ae3..bf4413977 100644 --- a/Server/models/Check.js +++ b/Server/models/Check.js @@ -90,11 +90,11 @@ CheckSchema.pre("save", async function (next) { if (monitor.status === true && this.status === false) { // Notify users that the monitor is down for (const notification of notifications) { - if (notification.email) { + if (notification.type === "email") { await emailService.buildAndSendEmail( "serverIsDownTemplate", { monitorName: monitor.name, monitorUrl: monitor.url }, - notification.email, + notification.address, `Monitor ${monitor.name} is down` ); } @@ -104,11 +104,11 @@ CheckSchema.pre("save", async function (next) { if (monitor.status === false && this.status === true) { // Notify users that the monitor is up for (const notification of notifications) { - if (notification.email) { + if (notification.type === "email") { await emailService.buildAndSendEmail( "serverIsUpTemplate", { monitorName: monitor.name, monitorUrl: monitor.url }, - notification.email, + notification.address, `Monitor ${monitor.name} is back up` ); }