Use promise/resolve for threaded email

This commit is contained in:
Vortrex
2022-06-12 09:17:54 -05:00
parent e2340c7ea2
commit e286e74274

View File

@@ -14,11 +14,12 @@ function initEmailScript() {
// =========================================================================== // ===========================================================================
function sendEmail(toEmail, toName, subject, body) { async function sendEmail(toEmail, toName, subject, body) {
if(!checkForSMTPModule()) { if (!checkForSMTPModule()) {
return false; return false;
} }
Promise.resolve().then(() => {
module.smtp.send( module.smtp.send(
getEmailConfig().smtp.host, getEmailConfig().smtp.host,
getEmailConfig().smtp.port, getEmailConfig().smtp.port,
@@ -30,7 +31,9 @@ function sendEmail(toEmail, toName, subject, body) {
subject, subject,
body, body,
getEmailConfig().smtp.from, getEmailConfig().smtp.from,
getEmailConfig().smtp.fromName); getEmailConfig().smtp.fromName
);
});
} }
// =========================================================================== // ===========================================================================