1

I've tried all solutions that have been already posted on the site like

1)Declaring host as smtp.gmail.com

2)secure:false and rejectUnauthorized as unregistered

3) Allowing less secure apps permission in Gmail

Code snippet looks like this

 var nodemailer = require('nodemailer');

 var transporter = nodemailer.createTransport({
 service: 'gmail',
 port:'465',
 secure: 'false',
 auth: {
    user: 'my_id',
    pass: 'my_password'
},
 tls: {
     rejectUnauthorized: false
}
});

var mailOptions = {
    from: 'myemail',
    to: receiver's email,
    subject: "some text",
    text: "some text"
};

 transporter.sendMail(mailOptions, function(error, info){
 if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
  });

and i still get the error

{ Error: connect ECONNREFUSED 74.125.124.109:465
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
code: 'ECONNECTION',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '74.125.124.109',
port: 465,
command: 'CONN' }

Any thoughts on how to solve this?

Sujay66
  • 103
  • 1
  • 11

1 Answers1

0

It is very possible, especially if you're on Windows, that you have an antivirus, antimalware, or firewall that is blocking the requests. Windows Firewall in particular is aggressive about blocking SMTP out from unregistered programs.

Paul
  • 35,689
  • 11
  • 93
  • 122
  • I'm doing it on a putty terminal which makes it a Linux environment so I suppose that isn't the issue. Kick started a node server tried to send an email from my website on the domain and this happens! – Sujay66 Aug 04 '17 at 01:08