one.com domain email SMTP request not working from render.com server

31 Views Asked by At

I'm running an Express JS server on render.com that is responsible for firing SMTP call to an email service. The email service is hosted on one.com (with a custom domain).

I'm using nodemailer to handle my SMTP call, which looks like this:

app.post("/send-mail", validate(schema), (req, res) => {
  console.log("sending email...");
  let transporter = nodemailer.createTransport({
    host: process.env.REACT_APP_HOST,
    port: process.env.PORT,
    auth: {
      user: process.env.REACT_APP_EMAIL_LOGIN,
      pass: process.env.REACT_APP_EMAIL_PASS,
    },
  });

This works just fine when running the Express JS server locally - I am successfully receiving the test email. But once I do the same from Render.com I get a timeout error:

Error: Connection timeout
    at SMTPConnection._formatError (/opt/render/project/src/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)
    at SMTPConnection._onError (/opt/render/project/src/node_modules/nodemailer/lib/smtp-connection/index.js:776:20)
    at Timeout.<anonymous> (/opt/render/project/src/node_modules/nodemailer/lib/smtp-connection/index.js:235:22)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7) {
  code: 'ETIMEDOUT',
  command: 'CONN'
}

Not sure what's the problem. Should try to transfer the domain to another domain provider or is the problem with Render.com?

I tried running the Express JS server on Render.com and expected that the SMTP call would be successful just as it is when firing from localhost. The settings are exactly the same but I get two different results.

1

There are 1 best solutions below

0
Sebastian Meckovski On

I found a solution by implementing a different SMTP provider, instead of nodemailer I used sendgrid.com and all works well now.