Error: connect ECONNREFUSED at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)

I am trying to set-up SMTP server to send emails, but not been able to

Getting this error:
Error: connect ECONNREFUSED
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)

Information on your n8n setup

  • **n8n version: 0.197.1
  • **Database you’re using (default: SQLite):Postgres
  • **Running n8n with the execution process [own(default), main]:own
  • **Running n8n via [Docker, npm,, desktop app]:Docker

Hi @geetakripalani, welcome to the community!

I am sorry to hear you’re having trouble. ECONNREFUSED would suggest a network problem. If you don’t have any components inside your local network blocking such connection attempts it might be worth checking for possible problems outside of your local network. Many ISPs would for example block port 25 to prevent their network from being used for spam. It might be worth double-checking if that’s the case for you.

If so, you might want to check whether your email service provider offers different ports. Sendgrid (one of the larger ESPs) for example would offer these ports which are fairly common:

SendGrid accepts unencrypted and TLS connections on ports 25, 587, & 2525. You can also connect via SSL on port 465. Many hosting providers and ISPs block port 25 as a default practice. If your Telent session continually times out or will not connect using port 25, it is likely that your ISP or hosting provider is blocking the port. You can contact your host/ISP to find out which ports are open for outgoing SMTP relay. We recommend using port 587 to avoid any rate limiting that your server host may apply.