1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

fix: uri encode smtp connection string (#901)

Signed-off-by: James Renaud <james.renaud@mitel.com>

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
This commit is contained in:
James Renaud 2021-08-12 16:32:16 -04:00 committed by GitHub
parent ff7be7696c
commit 8f1a5f5a64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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}`);