made sendEmail async

pull/308/head
Malte Delfs 2021-06-24 19:30:39 +02:00
parent 24f10e4f29
commit 2f20cf2968
1 changed files with 5 additions and 3 deletions

View File

@ -58,7 +58,7 @@ export default abstract class EventMail {
* Sends the email to the event attendant and returns a Promise.
*/
public sendEmail(): Promise<any> {
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: <a href="${this.getRescheduleLink()}">${this.getRescheduleLink()}</a>
`;
}
}
}