@dthyresson correction my solution actually didn’t help.
As you suggested, I put console.log
statements as follows:
export async function sendEmail({ to, subject, text, html }) {
console.log('Inside sendEmail function')
console.log('process.env.SMTP_HOST: ', process.env.SMTP_HOST)
console.log('process.env.SMTP_PORT: ', process.env.SMTP_PORT)
console.log('process.env.SMTP_USER: ', process.env.SMTP_USER)
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT,
secure: false,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
})
console.log('Before transporter.sendMail')
transporter.sendMail(
{
from: process.env.AUTH_EMAIL_FROM,
to: Array.isArray(to) ? to : [to],
subject,
text,
html,
},
(err, info) => {
if (err) {
console.log('Error sending email: ', err)
} else {
console.log('Email sent envelope:', info.envelope)
console.log('Email sent messageId:', info.messageId)
}
}
)
}
Here is the log I see on the netlify side:
Feb 2, 10:49:12 PM: b5753259 INFO process.env.SMTP_HOST: smtp-relay.sendinblue.com
Feb 2, 10:49:12 PM: b5753259 INFO process.env.SMTP_PORT: 587
Feb 2, 10:49:12 PM: b5753259 INFO process.env.SMTP_USER: myEMAIL ADDRESS
Feb 2, 10:49:12 PM: b5753259 INFO Before transporter.sendMail
One thing about this log is interesting. It doesn’t show the last console.log message about email being sent or error. I do see those on my local env though.
Any idea what might be happening?