0

Hi every one i am building a web app with back-end node.js i am using node mailer for transaction of mails to my account, well server run fine but when i am trying to send mail through web app it give me error :-

  code: 'EAUTH',
  response: '535-5.7.8 Username and Password not accepted. Learn more at\n' +
    '535 5.7.8  https://support.google.com/mail/?p=BadCredentials r188sm119472071pfr.16 - gsmtp',
  responseCode: 535,
  command: 'AUTH PLAIN'

indeed i am providing right credential please help me with that :

below is the code of config.js:--

module.exports={

    mailer:{
        service:'Gmail',
        auth:{
            user:'*********@gmail.com',
            pass:'********'
        }
    }
}

index.js

router.route('/contact')
  .get(function(req, res, next) {
    res.render('contact', { title: 'Call sharing platform'});
  })
  .post(function(req, res, next) {
    req.checkBody('name', 'Empty name').notEmpty();
    req.checkBody('email', 'Invalid email').isEmail();
    req.checkBody('message', 'Empty message').notEmpty();
    var errors = req.validationErrors();

    if(errors) {
      res.render('contact', {
        title: 'Call sharing platform',
        name: req.body.name,
        email: req.body.email,
        message: req.body.message,
        errorMessages: errors
      });
    } else {

      var mailoption={
        from:'callio<no-reply@callio.com>',
        to:'stark6977ai@gmail.com',
        subject:'you got new massage from visitor',
        text:req.body.message
      }

      transport.sendMail(mailoption,function(error,info){
        if (error){
          return console.log(error);
        }
        res.render('thanks', { title: 'Call sharing platform'});
      });

i have tried nslookup smtp.gmail.com

it respond correctly and still getting same error

GET /contact 304 95.353 ms - - GET /stylesheets/style.css 304 2.029 ms - - Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials z4sm118519662pfg.166 - gsmtp at SMTPConnection._formatError (/home/abhisek/Desktop/callcode/node_modules/nodemailer/lib/smtp-connection/index.js:555:19) at SMTPConnection._actionAUTHComplete (/home/abhisek/Desktop/callcode/node_modules/nodemailer/lib/smtp-connection/index.js:1244:34) at SMTPConnection. (/home/abhisek/Desktop/callcode/node_modules/nodemailer/lib/smtp-connection/index.js:338:26) at SMTPConnection._processResponse (/home/abhisek/Desktop/callcode/node_modules/nodemailer/lib/smtp-connection/index.js:702:20) at SMTPConnection._onData (/home/abhisek/Desktop/callcode/node_modules/nodemailer/lib/smtp-connection/index.js:507:14) at TLSSocket. (/home/abhisek/Desktop/callcode/node_modules/nodemailer/lib/smtp-connection/index.js:459:47) at TLSSocket.emit (events.js:203:13) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at TLSSocket.Readable.push (_stream_readable.js:210:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:166:17) { code: 'EAUTH', response: '535-5.7.8 Username and Password not accepted. Learn more at\n' + '535 5.7.8 https://support.google.com/mail/?p=BadCredentials z4sm118519662pfg.166 - gsmtp', responseCode: 535, command: 'AUTH PLAIN' }

Abhisek Singh
  • 340
  • 2
  • 10
  • Where is your code for creating "transport"? ("nodemailer.createTransport(...)") – noitse Aug 02 '19 at 12:14
  • @noitse thanks for looking into it the code is below var nodemailer= require('nodemailer'); var config=require('../config'); var transporter = nodemailer.createTransport(config.mailer) – Abhisek Singh Aug 03 '19 at 21:57

0 Answers0