Added a new type of e-mail to send to students when a new assignment is created

This commit is contained in:
Tiago Ribeiro
2024-01-17 15:55:33 +00:00
parent 63d2baf35f
commit 74dcccf089
6 changed files with 178 additions and 126 deletions

View File

@@ -40,3 +40,15 @@ export function prepareMailOptions(context: object, to: string[], subject: strin
context,
};
}
export async function sendEmail(template: string, context: object, to: string[], subject: string): Promise<boolean> {
try {
const transport = prepareMailer(template);
const mailOptions = prepareMailOptions(context, to, subject, template);
await transport.sendMail(mailOptions);
return true;
} catch {
return false;
}
}