From 683a85ecc0b4225024e42b67da5f13a9173ea3bb Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 30 Nov 2018 00:35:17 +0900 Subject: [PATCH] Fix SMTP (#3436) --- src/server/api/endpoints/i/update_email.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/api/endpoints/i/update_email.ts b/src/server/api/endpoints/i/update_email.ts index b44cf0dff..e08d1fba0 100644 --- a/src/server/api/endpoints/i/update_email.ts +++ b/src/server/api/endpoints/i/update_email.ts @@ -69,12 +69,14 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { const meta = await fetchMeta(); + const enableAuth = meta.smtpUser != null && meta.smtpUser !== ''; + const transporter = nodemailer.createTransport({ host: meta.smtpHost, port: meta.smtpPort, secure: meta.smtpSecure, - ignoreTLS: true, - auth: meta.smtpUser != null ? { + ignoreTLS: !enableAuth, + auth: enableAuth ? { user: meta.smtpUser, pass: meta.smtpPass } : undefined