Error 534 when sending an email with Nodemailer

0

I have a web project where sporting events are created and when creating an event I have to send an email, it is the first time I use nodemailer.

I'm doing shipping tests so for that I have a link that by clicking the driver of the url you must send the mail. but I get error.  The codes are the following:

Link:

<a href="/admin/enviar">enviar correo</a>

JavaScript:

var transporter = nodemailer.createTransport({
    service: 'gmail',

    auth: {
        user: '[email protected]',
        pass: '*********'
    }
});
router.get('/enviar', function (req, res, next) {
        console.log("voy a enviar un correo");
        var mailOptions = {
            from: '"ColSport ?" <[email protected]>', // sender address
            to: '[email protected], [email protected]', // list of receivers
            subject: 'Hello ✔', // Subject line
            text: 'Hello world ?', // plaintext body
            html: '<b>Hello world ?</b>' // html body
         };
        transporter.sendMail(mailOptions, function(error, info) {
            if (error) {
                return console.log(error);
            }
            console.log('Message %s sent: %s', info.messageId, info.response);
        });
        res.redirect('back');
    })

Result:

    
asked by Daniel Enrique Rodriguez Caste 31.01.2017 в 23:02
source

1 answer

0
  

Google may block access to some apps or devices that do not use modern security standards. By blocking them, the security of your account is maintained, since it is easier to access these apps and devices without authorization

.

The problem is that you have not activated the access to your account from less secure apps . Once this is done, you can log in with GMail from any client. To avoid activating this option in your account, you will need to give extra security to your application, in particular to provide a way to authenticate with Google via encryption so that it is not possible to intercept the entry data. In this one question you can read in more detail the risks that may exist.

    
answered by 01.02.2017 / 14:32
source