-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Description
If you have the issue in the emai.js, you can't send the email in the respective sender, just add this try and catch block in the await section. If you find helpful or have any bug let me know..
const nodemailer = require('nodemailer');
const sendEmail = async option => {
// CRREATE A TRNSPORTER..
const transport = nodemailer.createTransport({
host: "sandbox.smtp.mailtrap.io",
port: 2525,
auth: {
user: "5a64213903a459",
pass: "9501fec9e11b1f"
}
});
// DEFINE THE EMAIL..
const mailOption = {
from: 'Soumya <[email protected]>',
to: option.email,
subject: option.subject,
text: option.message
}
// SEND THE EMAIL..
try {
await transport.sendMail(mailOption);
console.log("The email has been sent!");
} catch (error) {
console.error(error);
}
}
module.exports = sendEmail;
Metadata
Metadata
Assignees
Labels
No labels