Docker SMTP Invite Emails Failing — ECONNREFUSED 127.0.0.1:465 When Inviting Users

Good afternoon,

I’m new to n8n and started using it via Docker less than a week ago. I really like the platform, but I’m facing a specific issue related to user invitation emails.

Problem

When inviting users through:

n8n → Settings → Users

Invitation emails are not delivered.
Sending the invitation link manually also does not work.

Now, when trying to resend an invitation, I receive:

Could not reinvite user
connect ECONNREFUSED 127.0.0.1:465

What I have already checked

  • SMTP configured

  • Tried resending invitations

  • Reviewed similar community topics:

https://community.n8n.io/t/invite-emails-contain-incorrect-port-in-url-when-using-nginx-reverse-proxy-with-subpath/105397

https://community.n8n.io/t/user-management-how-to-invite-users-with-ssl-less-unauthenticated-smtp-server/12940/26

None of these solved my issue.

Docker Environment

Container Name: n8n
Ports: Host 5678
Volume: n8n_data → /home/node/.n8n

SMTP Variables

  • N8N_EMAIL_MODE=smtp

  • N8N_SMTP_HOST=localhost

  • N8N_SMTP_PORT=465

  • N8N_SMTP_USER=foo

  • N8N_SMTP_PASS=bar

  • N8N_SMTP_SENDER=email@mydomain

Other Variables

  • GENERIC_TIMEZONE=America/Fortaleza

  • TZ=America/Fortaleza

  • N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true

  • N8N_MIGRATE_FS_STORAGE_PATH=true

n8n Information

  • n8n version: 2.8.3

  • Running via: Docker

Questions

  1. Does ECONNREFUSED 127.0.0.1:465 indicate an SMTP connection problem inside the container?

  2. Is there any additional required configuration for invitation emails?

Any guidance would be greatly appreciated.

hello pedro, welcome to n8n community

what your facing right now n8n cannot connect to the SMTP server because the host and port configuration is incorrect that means it is pointing to localhost inside the container.

and also check your docker-compose.yml like this below
environment:

  • N8N_SMTP_HOST=smtp.yourprovider.com

  • N8N_SMTP_PORT=465

  • N8N_SMTP_USER=your_email

  • N8N_SMTP_PASS=your_password

  • N8N_SMTP_SENDER=your_email

  • N8N_SMTP_SSL=true
    make sure your your N8N_SMTP_HOST=127.0.0.1 not like this must be your domain name

    hope this help

1 Like

In this case, I’ve just realized that I don’t have an SMTP configured. How can I work around this issue and invite our users (what is the maximum number of users allowed in a localhost project)?

I already tried simply sending the invitation link, but it has a problem: it doesn’t work properly and always redirects my invitees to their own n8n home page.

This is an invitation link that I sent earlier to a collaborator, which didn’t work:
http://localhost:5678/signup?inviterId=N/A&inviteeId=N/A