Can't send invitation to n8n via email

I was setup mail server in n8n but can’t sent any invite(
There are message “Failed to send email” in logs only
Снимок экрана 2022-05-25 в 11.40.00

My email setup:

  - N8N_EMAIL_MODE=smtp
  - N8N_SMTP_HOST=""
  - N8N_SMTP_PORT="587"
  - N8N_SMTP_USER="[email protected]"
  - N8N_SMTP_PASS="right_pass"
  - N8N_SMTP_SENDER="n8n automation service GPBI"
  - N8N_SMTP_SSL=true
  • n8n version:0.178.0
  • Database you’re using (default: SQLite):PG13
  • Running n8n via [Docker, npm,, desktop app]:Docker behind nginx

Please tell me where I was wrong with setup

Hey @Konstantin, I think a valid Yandex configuration (once you’ve enabled SMTP as described in their docs) would look like so:

[email protected]
[email protected]

That said, when I tried this, Yandex’ SMTP server rejected the invitations sent by n8n:

2022-05-25T09:03:12.051Z | error    | Failed to send email {"recipients":"[email protected]","error":{"code":"EMESSAGE","response":"554 5.7.1 Message rejected under suspicion of SPAM; 1653469390-HJ9Eb4DLIS-3AKC8sjP","responseCode":554,"command":"DATA"},"file":"NodeMailer.js","function":"sendMail"}

This response “Message rejected under suspicion of SPAM” is coming from Yandex and I don’t think this problem could be addressed from n8n’s end unfortunately. Yandex simply doesn’t seem to like automated messages :frowning:

So you might want to consider an alternative email provider for use with n8n or manually accept new users without an email being sent as suggested here: [User Management] How to invite users with SSL-less/unauthenticated SMTP server? - Questions - n8n

1 Like

Hey, @MutedJam!
Thanks for quick answer
Perhaps, I’ll use another mail server
Yandex - not the best for automation mailing
Have a nice day! :hugs:

1 Like

You are most welcome.

Tbf, I don’t speak Russian so couldn’t fully understand the help page provided by Yandex: Борьба со спамом - Почта. Справка

Perhaps their support can further assist you and whitelist such messages. There is also a chance they might not identify your messages as spam if you use your mailbox more regularly than I do once you have configured the SMTP settings I have shared above.

If you want to try it, you might want to set the N8N_LOG_LEVEL=debug environment variable to get the maximum possible logging output on your server.

1 Like

Yep, Yandex tell us bye-bye with automated messages
So, I’ll made own internal mail server and use it
Thank You once again and have a nice day!

1 Like

Awesome, have a great day as well!

This is strange but I have same error with my own exim server
I can telnet to 25 port from machine and from docker container to server but have this
error | Failed to send email {"recipients":"[email protected]","error":{"errno":-3008,"code":"EDNS","syscall":"getaddrinfo","hostname":"\"exim_ip\"","command":"CONN"},"file":"NodeMailer.js","function":"sendMail"}

Docker-compose params here:
- N8N_SMTP_HOST=“exim_ip”
- N8N_SMTP_PORT=“25”
- N8N_SMTP_USER=“noreply@exim_server”
- N8N_SMTP_PASS=“pass”
- N8N_SMTP_SENDER=“n8n automation service GPBI”
- N8N_SMTP_SSL=false

Hey @Konstantin , I have not seen this particular error coming from NodeMailer, but I could find this information:

(…) Unfortunately, the error code -3008 is represented as “Unknown error”. My guess is that the error code comes from somewhere else than the getaddrinfo function, perhaps some underlying system call (…)

So unfortunately I can’t quite tell what’s wrong here. Just out of curiosity, could you test this using an email provider like Sendgrid? That was the provider I have used for n8n user management and it worked fine using a configuration like this:

- N8N_SMTP_USER=apikey
- N8N_SMTP_PASS=myTopSecretPassword
- [email protected]

This should at least tell us if it’s just n8n not liking your SMTP server or if there’s something outside of n8n at play.

1 Like

I am having a similar problem. I can telnet and manually from my lxc container authenticate to my mail server and send an email. I can even create a node to send an email. However I can’t get my self hosted n8n to send an invitation email or forgot my password email.
I have environment variables set at in my /profile
export N8N_EMAIL_MODE=smtp
export N8N_SMTP_PASS=myvalidpasword
export [email protected]
export N8N_SMTP_USER=validuser
export N8N_SMTP_SSL=false
Any ideas?

Hey @CAslc, it looks like you didn’t set any SMTP port. So this would be the first thing I’d check.

I have the port set at
export N8N_SMTP_PORT=465

Is there a log I can look at to see why it is failing?

You could check the console output of your n8n instance (or alternatively check the log file if you write your instance logs into a file), but it might not have a helpful error unfortunately. It’d still be good to check.

Some things that come to my mind:

  • Where you also using port 465 when testing your email server through other means? I know many ISPs block this port.
  • Could you double check n8n is able to read your variables? I assume when you were sending emails through a regular n8n node you were using the same settings. So I am wondering if this could be a problem with n8n not being able to access your environment variables. You can for example verify this by running a workflow like the one below (make sure to actually execute it, the variable would not show up in the UI preview):

Lastly, could you confirm which email provider you are using? Just so I can test this provider on my end.

Using the workflow you provided I was able to figure it out. We are using PM2 and the environment variables were not being passed to the PM2 environment where N8N was running. Thanks for your help.

1 Like

Awesome, glad to hear this is now working :slight_smile:

Thanks for confirming!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.