Reputation: 117
I am trying to sending email using MailTrap for Testing sendMail() always return error i tried all ports 25,2525,587
and this my function
const sendEmail = async (options) => {
// Create a transporter
const transporter = nodemailer.createTransport({
// host: process.env.EMAIL_HOST,
host: "sandbox.smtp.mailtrap.io",
port: 587,
auth: {
user: process.env.EMAIL_USERNAME,
pass: process.env.EMAIL_PASSWORD,
},
});
//email options
const mailOptions = {
from: "marim <[email protected]>",
to: options.email,
subject: options.subject,
text: options.message,
// html:
};
// send the email
await transporter.sendMail(mailOptions);
};
Upvotes: 1
Views: 89