Next.js Discord

Discord Forum

SMTP mail error

Unanswered
Black-capped Petrel posted this in #help-forum
Open in Discord
Black-capped PetrelOP
I am trying to send email using SMTP in API router. I already checked that SMTP is allowed on vercel. But I always get a timeout.
I have tried that I can send the email locally or on netlify, and I am using await as mentioned in the docs.
I am using Next.js 14 and Node.js 20.x. 20.x is the only choice because I also use canvas, which is not supported by 18.x.

The error information :
Task timed out after 10.01 seconds
Task timed out after 10.01 seconds

Here are some of my code snippets.

const transporter = nodemailer.createTransport({
host: 'smtp-mail.outlook.com',
port: 587,
secure: false,
auth: {
user: 'myEmail@outlook.com',
pass: process.env.EMAIL_PASS,
},
});

const mailOptions = {
from: 'Bridger-Code@outlook.com',
to: ${Email},
subject: 'Bridger - Verification',
html: htmlContent,
headers: {
'Reply-To': 'no-reply@example.com',
},
};

const info = await transporter.sendMail(mailOptions);

0 Replies