refactor(sendmail): updated the smtp per alpla needs

This commit is contained in:
2026-02-16 18:59:12 -06:00
parent 316af4233f
commit ace73fa919
2 changed files with 116 additions and 114 deletions

View File

@@ -67,34 +67,34 @@ export const sendEmail = async (data: any): Promise<any> => {
fromEmail = process.env.EMAIL_USER;
} else {
// convert to the correct plant token.
const plantToken = settingData.filter((s) => s.name === "plantToken");
//const plantToken = settingData.filter((s) => s.name === "plantToken");
let host = `${plantToken[0].value}-smtp.alpla.net`;
// let host = `${plantToken[0].value}-smtp.alpla.net`;
const testServers = ["test1", "test2", "test3"];
// const testServers = ["test1", "test2", "test3"];
if (testServers.includes(plantToken[0].value)) {
host = "USMCD1-smtp.alpla.net";
}
// if (testServers.includes(plantToken[0].value)) {
// host = "USMCD1-smtp.alpla.net";
// }
if (plantToken[0].value === "usiow2") {
host = "USIOW1-smtp.alpla.net";
}
// if (plantToken[0].value === "usiow2") {
// host = "USIOW1-smtp.alpla.net";
// }
transporter = nodemailer.createTransport({
host: host,
port: 25,
rejectUnauthorized: false,
//secure: false,
// auth: {
// user: "alplaprod",
// pass: "obelix",
// },
host: "smtp.azurecomm.net",
port: 587,
//rejectUnauthorized: false,
tls: {
minVersion: "TLSv1.2",
},
auth: {
user: "donotreply@mail.alpla.com",
pass: process.env.SMTP_PASSWORD,
},
debug: true,
} as SMTPTransport.Options);
// update the from email
fromEmail = `donotreply@alpla.com`;
});
fromEmail = `DoNotReply@mail.alpla.com`;
}
// creating the handlbar options