First of all, thanks to the community for building such an exciting tool !
I’ve spent quite some time trying to deploy my own instance of n8n on docker from a small VPS, which is mostly working flawlessly.
My only issue right now is that I cannot get the “Send Email” node to work. I’ve tried numerous different SMTP credentials (SES, Mailjet) with/without TLS, on ports 25/465/587, but no matter what I try, executing the Node consistently ends with a timeout error:
ERROR: Connection timeoutThis text will be hidden
Error: Connection timeout
at SMTPConnection._formatError (/usr/local/lib/node_modules/n8n/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._onError (/usr/local/lib/node_modules/n8n/node_modules/nodemailer/lib/smtp-connection/index.js:770:20)
at Timeout.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/nodemailer/lib/smtp-connection/index.js:235:22)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
Admittedly it’s my first time working with docker-compose, so I’m probably missing something…
I tweaked the documentation’s docker-compose.yml file a little so that I could launch n8n along with traefik and portainer. I’ve also tried to deploy an smtp container (namshi/smtp, docker-mailserver…) and link it to n8n, again to no avail.
Is SMTP supposed to work out of the box? If not, would someone kindly walk me through the steps needed to get there?
Hey @pec! Welcome to the community (and thanks for the kind words ).
I’m going to leave answers the question about the SMTP node to those who know more about it that I do (ahem…@jan) but I would like to provide a bit of perspective on SMTP (an network in general) troubleshooting.
When you have a network service, such as SMTP, there are usually one of three things that is misconfigured:
The service (SMTP)
The client (SMTP Node)
The network (Docker, VPS, ISP, Internet, etc.)
So, since the network is the most complex, let’s take a look at it first. Because there are so many different things that can cause network problems, many of which are outside of your control (e.g. Internet), one approach is to bring your services as close to you as possible and rely on others as little as possible. So, to to that in this instance, I would suggest putting the SMTP service of your VPS (or even inside your Docker container). This way, it reduces the hops it has to make over the network(s), reducing the likelihood that the communication will get lost.
I’m going to talk about the client and the service together because their configurations are so closely linked together. you need to go through the service and the client configurations side by side, making sure that they match up with the other. so, for example, if the server side requires TSL, then the client side must provide TSL.
In your instance, Docker also provides another aspect to investigate (I have to admit that my Docker experience is limited but I’m working to resolve that). May I suggest some of the Docker networking tutorials as a quick guide.
Thanks a lot @Tephlon for the general debug overview.
@pec Actually it should normally simply work. But there are some known problems with SSL with the base alpine image. So it is maybe worth trying the ubuntu image instead.
All n8n versions have them also build by default and you simply have to add -ubuntu. Meaning the latest ubuntu image would be: n8nio/n8n:0.67.3-ubuntu
@Tephlon, thank you so much for the exhaustive explanations and your link to the Docker tutorials. As far as the configuration goes, I am absolutely certain that the credentials match and are otherwise functional. @jan Thank you too! I was hopeful but unfortunately changing the image did not do the trick. I also tried downgrading to n8nio/n8n:0.67.0-ubuntu, which did not work either.
Note that other nodes such as Google Sheets and HTTP request work perfectly!
I just tried running telnet from within the container, and it actually never goes through… Again, tried with the AWS smtp host as well as with various ports
[email protected]:/# telnet in-v3.mailjet.com 587
telnet: Unable to connect to remote host: Connection timed out
Very strange. But then it sounds like it would not be n8n related. Can you connect to it via telnet from your host? If so can you connect through it via other docker images?
There should not be anything in the n8n docker image I am aware of which should block access. For that reason would it be very interesting to know the answers to the above questions to narrow the problem down.
Ok then it is at least for sure not docker or n8n related.
I can also not imagine that Cloudflare is the issue. Only your incoming traffic runs through it but not your outgoing one.
Is it also an AWS server you are running n8n on? Because they have like special network settings where you can control what incoming and outgoing traffic is allowed.
This is shameful… Hidden in plain sight. The fact that SMTP was going through from other instances, somehow, made me completely overlook this possibility. Indeed the timeout immediately went away. Thanks a bunch for this.
Now the error is this, which is probably a bad traefik configuration. There’s an abundance of results on Google so I’ll try to dig into it on my own.
ERROR: 139748966340416:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332: