fix: welcome email failing

This commit is contained in:
Rotimi Best
2024-09-23 20:58:50 +01:00
parent 0349e8c531
commit eaf078d8e2
2 changed files with 1 additions and 38 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ async function sendWithNodemailer(emailData) {
}
return await transporter.sendMail({
from: from || '"Best from ClassroomIO" <best@classroomio.com>',
from: from || '"Best from ClassroomIO" <notify@classroomio.com>',
to,
subject,
replyTo,
-37
View File
@@ -1,37 +0,0 @@
const nodemailer = require('nodemailer');
const { SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_USER_NOTIFY, SMTP_PASSWORD_NOTIFY } =
process.env;
const getTransporter = async (isPersonal = false) => {
if (
!SMTP_HOST ||
!SMTP_PORT ||
!SMTP_USER ||
!SMTP_PASSWORD ||
!SMTP_USER_NOTIFY ||
!SMTP_PASSWORD_NOTIFY
) {
console.error('SMTP configuration missing');
return null;
}
try {
const transporter = nodemailer.createTransport({
host: SMTP_HOST,
port: parseInt(SMTP_PORT || '465', 10),
secure: true,
auth: {
user: isPersonal ? SMTP_USER : SMTP_USER_NOTIFY,
pass: isPersonal ? SMTP_PASSWORD : SMTP_PASSWORD_NOTIFY
}
});
await transporter.verify();
return transporter;
} catch (error) {
console.error('Transporter error:', error);
return null;
}
};
module.exports = { getTransporter };