Vasilis Greece
Vasilis Greece

Reputation: 907

nodemailer check if the mail has been sent

I am using nodemailer with nodejs express.

What I want to know is if my mail is sent successfully to the recipient. My mail service belongs to zoho.com.

const nodemailer = require('nodemailer');

 let transporter = await nodemailer.createTransport({
    host: "smtp.zoho.com",
    port: 465,
    secure: true, 
    auth: {
      user: '[email protected]', 

      pass: '******', 
    },
    tls: {
      rejectUnauthorized: false
    } 
  });

let info = await transporter.sendMail({
    from: '"Test mail" <[email protected]>', // sender address
    to: "[email protected]", // list of receivers
    subject: "Hello ✔", // Subject line
    text: "Hello world?", // plain text body
    html: "<b>Hello world?</b>", // html body
  }, (error, result) => {
    if (error) return console.error(error);
  });

The mail "[email protected]" it doesn't exist and the error is not triggered. How to check if my mail is delivered or not, with nodemailer?

Upvotes: 2

Views: 2055

Answers (1)

Dhairya
Dhairya

Reputation: 33

Nodemailer can simply pass the message to the relay, and from here Nodemailer gives response of the api. And that's why there will no error occur for invalid e-mail address.

Upvotes: 1

Related Questions