Node js

how to send an email to nodejs from Gmail

Pinterest LinkedIn Tumblr
       
        var nodemailer = require('nodemailer');
         var send = require('gmail-send');
         var mailserverifo = nodemailer.createTransport({
         service: 'gmail',
         host : "smtp.gmail.com",
         port : "465",
         ssl : true,
         auth: {
         user: '[email protected]',
         pass: '[email protected]'
        }
        });
          var Mailinfo = {
          from: '[email protected]',
          to: '[email protected]',
          subject: 'Testing email from node js server',
          text: 'That was easy!'
         };

        mailserverifo.sendMail(Mailinfo, function(error, info){
        if (error) {
         console.log(error);
        } else {
         console.log('Email Send Success: ' + info.response);
        }
        });
    
       Enable less secure app form setting -
       
      

https://www.google.com/settings/security/lesssecureapps

Allow access for “Display Unlock captcha option” (Allow access to your Google account). Here is the link :
Here is the link :

https://accounts.google.com/DisplayUnlockCaptcha

Write A Comment

Open chat
Hey Visitor,

How can I help you?