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,23 +14,26 @@ function initEmailScript() {
// ===========================================================================
function sendEmail(toEmail, toName, subject, body) {
if(!checkForSMTPModule()) {
async function sendEmail(toEmail, toName, subject, body) {
if (!checkForSMTPModule()) {
return false;
}
module.smtp.send(
getEmailConfig().smtp.host,
getEmailConfig().smtp.port,
intToBool(getEmailConfig().smtp.useTLS),
getEmailConfig().smtp.username,
getEmailConfig().smtp.password,
toEmail,
toName,
subject,
body,
getEmailConfig().smtp.from,
getEmailConfig().smtp.fromName);
Promise.resolve().then(() => {
module.smtp.send(
getEmailConfig().smtp.host,
getEmailConfig().smtp.port,
intToBool(getEmailConfig().smtp.useTLS),
getEmailConfig().smtp.username,
getEmailConfig().smtp.password,
toEmail,
toName,
subject,
body,
getEmailConfig().smtp.from,
getEmailConfig().smtp.fromName
);
});
}
// ===========================================================================