0

Iam trying to send node mailer using webmail instead of GMail using smtp sever as follows..

// config connections
"nodemailer" : { 
         
         "host": "smtp.in-sciencelabs.com",
         "port": 587,
        "auth": {
        "user": "myuser.com", 
        "pass": "myp@ssword"
    }

// in nodemailer.js code iam importing the config details....

const transporter=
nodemailer.createTransport(smtpTransport((config["nodemailer"])));
     var mailOptions = {
               from: `${config["nodemailer"]["user"]}`,
               to: tomail,
               subject: subject ,
               text: data
             };
             transporter.verify(function(error, success) {
               if (error) {
                 console.log(error,"17");
               } else {
                 console.log("Server is ready to take our messages");
               }
             });

i tried to verify the connections so its shows an error like this

(Error: connect ETIMEDOUT)***.**.***.***:587
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -4039,
  code: 'ECONNECTION',
  syscall: 'connect',
  address: 'xxx.xx.xxx.xxx',
  port: 587,
  command: 'CONN'
}

here iam trying this but its not workout for me but in another system emails are sending so i dont know which setting is going to change in system for sending an email could you please help me out from this problem and i also changed the node version to 12.18.3

Divya rani
  • 1
  • 1
  • 2

1 Answers1

0

Have you looked at this answer.

It turns out that in order for Google to authorize a third party server to access your account via SMTP now, you have to enable “Less Secure Apps” on your gmail account, if you want to use username/password (more info here).

So you have two option:

  • use OAuth

  • make your account less secure

you also need to check your server firewall setting, This may be firewall problem, Problem can be solved by enabling TCP inbound and outbound in firewall settings on your server, if you are using digital ocean then you can find it in firewall settings in panel

Nabeel Sajid
  • 193
  • 6
  • I updated the question... Iam using webmail services instead of Gmail can you please once again see the question and verify the mistake – Divya rani May 26 '21 at 05:23
  • have you checked your server firewall settings? Or may be port is wrong, the server is not up, or you don't have connectivity. but I guess it is firewall problem, connect your server provider to change your firewall settings – Nabeel Sajid May 26 '21 at 06:22
  • here iam updated the question i found how to emails are sending. but not in mine ,in another system this is working ...could you please help me which changes are to be change because i dont have any clue how to modify settings in system for this problem... – Divya rani May 27 '21 at 08:02