NG42
NG42

Reputation: 11

How to verify a email without sending actual email(SMTP)

I want to check if a batch of email(gmail) address is valid and I didn't want to pay for a service. I tried openssl s_client but it keeps on renegotiating and failing and the documentation is too poor for me to resolve it.

RENEGOTIATING
3C690000:error:0A00010A:SSL routines:can_renegotiate:wrong ssl version:ssl\ssl_lib.c:2305:

Then I tried nodeMailer with nodejs on gmail, it worked. But the gmail SMTP server accepted invalid addresses(catch-all?) and even sent a blank email to the recipient with no data. Email verification does work on many paid serve https://email-checker.net/. I have no idea how those paid services work. I looked for forums, discussions and other resources online but I wasn't able to find any. Last thread on this was like 9 years ago.

import nodemailer from 'nodemailer'
const transporter = nodemailer.createTransport({
    host: "smtp.gmail.com",
    port: 465,
    auth: {
      user: '[email protected]',
      pass: 'passcode'
    }
});
function mailer(){
  const mailOptions = {
    from: '[email protected]',
    to: '[email protected]',
    // subject: 'Test Email',
    // text: 'This is a test email.'
  };
  transporter.sendMail(mailOptions, function(error, info) {
    if (error) {
      console.log(error);
    } else {
      console.log('Log: ' + info.response);
    }
  });
    
}

Upvotes: 1

Views: 340

Answers (0)

Related Questions