From 47f6cb31d78f83d5734b11285b11147b0b42e191 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Nov 2019 13:36:40 +0100 Subject: Fix email to field --- server/lib/emailer.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'server') diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index bd3d4f252..523b11d0d 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -441,7 +441,7 @@ class Emailer { return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) } - sendMail (options: EmailPayload) { + async sendMail (options: EmailPayload) { if (!Emailer.isEnabled()) { throw new Error('Cannot send mail because SMTP is not configured.') } @@ -450,13 +450,15 @@ class Emailer { ? options.fromDisplayName : WEBSERVER.HOST - return this.transporter.sendMail({ - from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`, - replyTo: options.replyTo, - to: options.to.join(','), - subject: options.subject, - text: options.text - }) + for (const to of options.to) { + await this.transporter.sendMail({ + from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`, + replyTo: options.replyTo, + to, + subject: options.subject, + text: options.text + }) + } } private dieOnConnectionFailure (err?: Error) { -- cgit v1.2.3