From 2f20cf2968248cf5afe6ed36a5b551665eeb941c Mon Sep 17 00:00:00 2001 From: Malte Delfs Date: Thu, 24 Jun 2021 19:30:39 +0200 Subject: [PATCH] made sendEmail async --- lib/emails/EventMail.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/emails/EventMail.ts b/lib/emails/EventMail.ts index b76bb5a1..de1c0507 100644 --- a/lib/emails/EventMail.ts +++ b/lib/emails/EventMail.ts @@ -58,7 +58,7 @@ export default abstract class EventMail { * Sends the email to the event attendant and returns a Promise. */ public sendEmail(): Promise { - return new Promise((resolve, reject) => nodemailer.createTransport(this.getMailerOptions().transport).sendMail( + new Promise((resolve, reject) => nodemailer.createTransport(this.getMailerOptions().transport).sendMail( this.getNodeMailerPayload(), (error, info) => { if (error) { @@ -67,7 +67,9 @@ export default abstract class EventMail { } else { resolve(info); } - })); + }) + ).catch((e) => console.error("sendEmail", e)); + return new Promise((resolve) => resolve("send mail async")); } /** @@ -133,4 +135,4 @@ export default abstract class EventMail { Reschedule: ${this.getRescheduleLink()} `; } -} \ No newline at end of file +}