From 0f1a95fde932f251a0bc9df326abc5ab3d38df13 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Tue, 13 Jul 2021 11:01:02 +0800 Subject: [PATCH] smtp without username password --- server/notification.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/notification.js b/server/notification.js index 59fb3555..30d2df83 100644 --- a/server/notification.js +++ b/server/notification.js @@ -135,15 +135,20 @@ class Notification { static async smtp(notification, msg) { - let transporter = nodemailer.createTransport({ + let data = { host: notification.smtpHost, port: notification.smtpPort, secure: notification.smtpSecure, - auth: { + }; + + if (notification.smtpUsername) { + data.auth = { user: notification.smtpUsername, pass: notification.smtpPassword, - }, - }); + }; + } + + let transporter = nodemailer.createTransport(data); // send mail with defined transport object let info = await transporter.sendMail({