Merge pull request #308 from Malte-D/hotfix/mail-async

hotfix: made sendEmail async
This commit is contained in:
Malte Delfs 2021-06-24 19:36:34 +02:00 committed by GitHub
commit c7bdecbad1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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