From 8f1a5f5a64f51c3cd8eaead2f37ddb910f775370 Mon Sep 17 00:00:00 2001 From: James Renaud Date: Thu, 12 Aug 2021 16:32:16 -0400 Subject: [PATCH] fix: uri encode smtp connection string (#901) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: James Renaud Co-authored-by: Ivar Conradi Ă˜sthus --- src/lib/services/email-service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/services/email-service.ts b/src/lib/services/email-service.ts index 30d1a0a4ca..1c8536edaa 100644 --- a/src/lib/services/email-service.ts +++ b/src/lib/services/email-service.ts @@ -2,6 +2,7 @@ import { createTransport, Transporter } from 'nodemailer'; import Mustache from 'mustache'; import path from 'path'; import { readFileSync, existsSync } from 'fs'; +import { escape } from 'querystring'; import { Logger, LogProvider } from '../logger'; import NotFoundError from '../error/notfound-error'; import { IEmailOption } from '../types/option'; @@ -57,7 +58,9 @@ export class EmailService { if (email.host === 'test') { this.mailer = createTransport({ jsonTransport: true }); } else { - const connectionString = `${email.smtpuser}:${email.smtppass}@${email.host}:${email.port}`; + const connectionString = escape( + `${email.smtpuser}:${email.smtppass}@${email.host}:${email.port}`, + ); this.mailer = email.secure ? createTransport(`smtps://${connectionString}`) : createTransport(`smtp://${connectionString}`);