Fix email to field
authorChocobozzz <me@florianbigard.com>
Fri, 29 Nov 2019 12:36:40 +0000 (13:36 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 29 Nov 2019 12:36:40 +0000 (13:36 +0100)
scripts/dev/server.sh
server/lib/emailer.ts

index b4675c57f54c3d8b3a4f609e9382f40d9291d079..beee5b8d49e4aacdd9e22a0eb10712f30dfb2ae3 100755 (executable)
@@ -2,8 +2,8 @@
 
 set -eu
 
-if [ ! -f "./client/dist/en_US/index.html" ]; then
-  echo "client/dist/en_US/index.html does not exist, compile client files..."
+if [ ! -f "./client/dist/en-US/index.html" ]; then
+  echo "client/dist/en-US/index.html does not exist, compile client files..."
   npm run build:client -- --light
 fi
 
index bd3d4f252eb120132bb01dd27cd5cb1655c7b59e..523b11d0dc9ad27411baf38414064be4a9d2d1fb 100644 (file)
@@ -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) {