Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error: read ECONNRESET when trying to use nodemailer with Hover.com email #170

Closed
gcatto opened this issue Jul 7, 2013 · 6 comments

Comments

@gcatto
Copy link

gcatto commented Jul 7, 2013

I'm relatively new to node.js for server development and definitely new to nodemailer, but it seems like a great option for my needs. I have it working with a gmail account as a test, but I've been trying to convert it to use an email address through Hover.com, but I'm getting an error: read ECONNRESET. I've triple-checked all of my parameters (host, port, user, pass, etc.) and everything looks okay and their help hasn't been able to help me yet either, so I thought I'd ask here.

My coffeescript for creating the transport is below:

transport = nodemailer.createTransport("SMTP", {
host: "mail.hover.com"
secureConnection: true
port: 465
auth: {
user:
pass:
}})

Thanks!

@gcatto
Copy link
Author

gcatto commented Jul 9, 2013

Interestingly, when I include the option parse: true in my createTransport(), nothing additional is outputted to the console, but when I use a different service (such as Gmail), I get all kinds of additional output to the console.

@andris9
Copy link
Member

andris9 commented Jul 10, 2013

Hi, it seems to be an issue with TLS library of Node v0.10.x. You should get the connection opened with the following configuration (see the additional tls option):

{
    host: "mail.hover.com",
    secureConnection: true,
    port: 465,
    auth:{
        user: "---",
        pass: "---"
    },
    tls:{
        secureProtocol: "TLSv1_method"
    }
}

@andris9 andris9 closed this as completed Jul 10, 2013
@gcatto
Copy link
Author

gcatto commented Jul 11, 2013

Awesome, that did it. I don't know if I would have figured that out, so I greatly appreciate your help!

@whyyue
Copy link

whyyue commented Aug 6, 2018

I still get this error while running my code:

const Email = require('email-templates');
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
    host: 'smtp.qq.com',
    port: 587,
    // secure: true,
    auth: {
        user: `${user}`,
        pass: `${password}`
    },
    // secureConnection: 'false',
    tls:{
        secureProtocol: "TLSv1_method"
    }
});

// mailOptions.to= destination
// mailOptions.from= user;

const email = new Email({
  message: {
    from: `${user}`
  },
  // uncomment below to send emails in development/test env:
  send: true,
  transport: transporter,
  views: {
            root: './emails'
        }
});
 
email
  .send({
    template: 'mars',
    message: {
      to: '1459714629@qq.com'
    },
    locals: {
      name: 'WHY'
    }
  })
  .then(res => {
    console.log('res.originalMessage', res.originalMessage
  )})
  .catch(console.error);

this is the error info:

{ Error: read ECONNRESET
    at _errnoException (util.js:992:11)
    at TCP.onread (net.js:618:25)
  code: 'ECONNECTION',
  errno: 'ECONNRESET',
  syscall: 'read',
  command: 'CONN' }

@liangwenzhong
Copy link

I still get this error while running my code:

const Email = require('email-templates');
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
    host: 'smtp.qq.com',
    port: 587,
    // secure: true,
    auth: {
        user: `${user}`,
        pass: `${password}`
    },
    // secureConnection: 'false',
    tls:{
        secureProtocol: "TLSv1_method"
    }
});

// mailOptions.to= destination
// mailOptions.from= user;

const email = new Email({
  message: {
    from: `${user}`
  },
  // uncomment below to send emails in development/test env:
  send: true,
  transport: transporter,
  views: {
            root: './emails'
        }
});
 
email
  .send({
    template: 'mars',
    message: {
      to: '1459714629@qq.com'
    },
    locals: {
      name: 'WHY'
    }
  })
  .then(res => {
    console.log('res.originalMessage', res.originalMessage
  )})
  .catch(console.error);

this is the error info:

{ Error: read ECONNRESET
    at _errnoException (util.js:992:11)
    at TCP.onread (net.js:618:25)
  code: 'ECONNECTION',
  errno: 'ECONNRESET',
  syscall: 'read',
  command: 'CONN' }

have you resolve the problem ?

@nur1208
Copy link

nur1208 commented Jan 17, 2021

i have the same problem, i'm using proxy, can please someone help me out?

my source code:
const nodemailer = require("nodemailer");

let transporter = nodemailer.createTransport({
service: "yahoo",
secure: true,
auth: {
user: "medo1208@yahoo.com",
pass: "wrvvkigxyittunfd",
},
tls: {
secureProtocol: "TLSv1_method",
},
});

let message = {
from: "medo1208@yahoo.com",
to: "medo0o6665@gmail.com",
subject: "signup successful",
text: "hello there",
};

transporter
.sendMail(message)
.then(() => {
console.log("you should receive an email from us");
// return res.status(200).json({ msg: "you should receive an email from us" });
})
.catch((error) => console.error(error));

error:
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20) {
errno: -4077,
code: 'ESOCKET',
syscall: 'read',
command: 'CONN'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants