Wednesday, 19 April 2017

Nodemailer ECONNRESET error 2017

I am having an issue with NodeMailer, I began to get ECONRESET errors (seemingly out of nowhere). I am using gmail, but haven't had issues with it before, emails used to send out fine. Anyway, I was hoping someone could see something that I am not. Yes, I have searched and found pretty old posts with the same errors, but their solutions haven't helped. Thanks in advance! P.S I have tried without TLS option, same result. Here is my code: (stack trace to follow)

let transporter = nodemailer.createTransport({
        service: 'gmail',
        auth: {
            user: process.env.EMAIL_USER,
            pass: process.env.EMAIL_PASS
        },
        tls: {
            rejectUnauthorized: false
        }
    });

    let mailOptions = {
        from: '"Admin" <fakemail@gmail.com>', // sender address
        to: email, // list of receivers
        subject: 'Welcome !', // Subject line
        text: 'Welcome!', // plain text body
        html: modifiedHtml // html body
    };

    // send mail with defined transport object
    transporter.sendMail(mailOptions, (error, info) => {
        if (error) {
            console.trace();
            return console.log('mailer error: ' + error);
        }
        console.log('Message %s sent: %s', info.messageId, info.response);
    });
}

Trace
    at transporter.sendMail (E:\Neo4jNode\db_operations\db.js:213:21)
    at transporter.send (E:\Neo4jNode\node_modules\nodemailer\lib\mailer\index.js:187:21)
    at SMTPConnection.connection.once.err (E:\Neo4jNode\node_modules\nodemailer\lib\smtp-transport\index.js:169:24)
    at SMTPConnection.g (events.js:292:16)
    at emitOne (events.js:96:13)
    at SMTPConnection.emit (events.js:188:7)
    at SMTPConnection._onError (E:\Neo4jNode\node_modules\nodemailer\lib\smtp-connection\index.js:547:14)
    at TLSSocket._socket.on.err (E:\Neo4jNode\node_modules\nodemailer\lib\smtp-connection\index.js:252:18)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
mailer error: Error: read ECONNRESET



via Gabe

No comments:

Post a Comment