Hello!
I was setup mail server in n8n but can’t sent any invite(
There are message “Failed to send email” in logs only

My email setup:
- N8N_EMAIL_MODE=smtp
- N8N_SMTP_HOST="smtp.yandex.ru"
- 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, n8n.cloud, desktop app]:Docker behind nginx
Please tell me where I was wrong with setup
Thnx
Hey @Konstantin, I think a valid Yandex configuration (once you’ve enabled SMTP as described in their docs) would look like so:
N8N_EMAIL_MODE=smtp
N8N_SMTP_HOST=smtp.yandex.com
N8N_SMTP_PORT=465
[email protected]
N8N_SMTP_PASS=myAppPassword
[email protected]
N8N_SMTP_SSL=true
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; https://ya.cc/1IrBc 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 
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! 
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_EMAIL_MODE=smtp
- N8N_SMTP_HOST=“exim_ip”
- N8N_SMTP_PORT=“25”
- N8N_SMTP_USER=“[email protected]_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_EMAIL_MODE=smtp
- N8N_SMTP_HOST=smtp.sendgrid.net
- N8N_SMTP_USER=apikey
- N8N_SMTP_PASS=myTopSecretPassword
- [email protected]
- N8N_SMTP_PORT=465
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