Hi, I’ve seen similar posts on this issue here, but no possible resolutions for me yet…
When i run netlify dev
, it works well.
On production - nothing… Don’t even get errors on logs.
Here’s the function - honestly doesn’t feel like anything special…
const nodemailer = require("nodemailer");
const handler = async function (request) {
const {
inviteeEmail,
inviteeName,
inviteeLastName,
inviteeJob_title,
workspaceId,
workspaceName,
inviterEmail,
inviterName,
inviterLastName,
pendingUserId,
} = JSON.parse(request.body);
const actionUrl = `${process.env.VITE_APP_BASE}/accept-invite?puid=${pendingUserId}&workspaceId=${workspaceId}`;
const transporter = await nodemailer.createTransport({
host: process.env.VITE_SMTP_HOST,
port: process.env.VITE_SMTP_PORT,
auth: {
user: process.env.VITE_SMTP_USERNAME,
pass: process.env.VITE_SMTP_PASSWORD,
},
});
const mailOptions = {
from: process.env.VITE_SMTP_FROM,
to: inviteeEmail,
subject: "Subject",
html: `<htm>...the template here...</html>`,
};
await transporter.sendMail(mailOptions, async (error, info) => {
if (error) {
console.log(error);
} else {
console.log('Email sent');
}
});
return {
statusCode: 200,
body: "success",
};
};
module.exports = { handler };
Can anyone spot the issue at all?