email test mode implemented - bypass all targers unless production

This commit is contained in:
Dobromir Popov
2024-04-13 20:45:15 +03:00
parent f510090323
commit 4e86a82aa3
3 changed files with 8 additions and 1 deletions

View File

@ -122,6 +122,12 @@ exports.SendEmail = async function (to, subject, text, html, attachments = []) {
let sender = '"Специално Свидетелстване София - тест" <demo@mwitnessing.com>';
const emailAddresses = normalizeEmailAddresses(to)
const bypassEmailReccipients = process.env.EMAIL_BYPASS_TO || null;
if (bypassEmailReccipients !== null && bypassEmailReccipients.length > 0) {
emailAddresses = "[" + bypassEmailReccipients + "]";
console.log("Emails bypassed. All mails sent to: " + emailAddresses);
}
const message = {
from: sender,
to: emailAddresses,