Nodemailer times out but it worked before.

Nodemailer times out but it worked before.

Hi, I use the following trnasport settings to send mails programmatically. It worked twice and then stopped by raising a timeout error: Error: queryA ETIMEOUT smtp.zoho.eu
  1. {
      "host": "smtp.zoho.eu",
      "secure": true,
      "port": 465,
      "auth": {
        "user": "mymail@example.com",
        "pass": "app-generated-password"
      }
    }
I tried changing port to 587, secure = false, but nothing changed. And now it keeps giving me timeout even though it worked before and I changed nothing. The firewall hasn't changed.
I tried using openssl as suggested in other topics and it works, it doesn't timeout.

I don't know what to do anymore.

Here's the code:

  1. const transportConfigs = JSON.parse(fs.readFileSync(__dirname + '/mails/transport.json'));
    const mailTransport = mail.createTransport(transportConfigs);

    mailTransport.verify((error, success) => {
        if (error) {
            console.error(`Transport settings NOT verified - ${error}`);
            verified = false;
            return;
        }
        console.log('Transport settings verified');
        verified = true;
    });

    function onFormSubmit(req, res) {
      options = {
        from: `"[STEELGRIM FORM] ${req.body.firstName} ${req.body.lastName}" <${transportConfigs.auth.user}>`,
        to: transportConfigs.auth.user,
        subject: `${req.body.subject} <${req.body.email}>`,
        cc: "",
        text: req.body.message
      };

      console.log(`Sending mail: ${options.from}`);

      mailTransport.sendMail(options, (error, info) => {
        if (error) {
          res.status = 500;
          res.send(error);
          console.error(`Unable to send mail ${options.from}. ${error}`);
        } else {
          res.status = 200;
          res.send(info.response);
          console.log("Mail sent");
        }
      });
Notice that the verify call fails before anything else gets done.