Problems to reach IMAP Email Server

Hi Guys! I m new. Sorry for my English, its rusty.

I’m trying to read my inbox, but I can’t reach the server, because of the error I can see. I created the entry in the / etc / hosts of the Docker, but a so did not succeed. If I ping, from the Docker, I have no problems. Even so, I cannot access the Mailbox.

ERROR: getaddrinfo ENOTFOUND imap.hostinger.com.ar

```
Error: getaddrinfo ENOTFOUND imap.hostinger.com.ar 
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)
```

In the image:

  1. The error.
  2. Docker Start.
  3. Ping to Imap server, from the host.
  4. /etc/hosts with the Imap Server.

From the Docker i can reach. Can you give an advise?

PD: Hoy can i watch the logs, with tail -f?

Thanks!

Very sorry but sadly not the slightest idea right now what could be wrong if you can reach it fine via the command line. Very strange problem. If I can think of anything I get back to you but to be honest the chance is small. You probably really have to keep on debugging. Sorry.

n8n does not write any logs that could be watched.

This is working for me (detecting host at terminal).

Have you tried to point to your imap server by ip? I assume it’s something related by DNS resolution (no idea why because inside container dns is working properly).

I have launched this entering my docker container this way:

# docker exec -ti YOURCONTAINERIDINDOCKER /bin/sh

# ping imap.hostinger.com.ar
PING imap.hostinger.com.ar (153.92.2.13): 56 data bytes
64 bytes from 153.92.2.13: seq=0 ttl=54 time=7.477 ms

# nc -zv imap.hostinger.com.ar 143
imap.hostinger.com.ar (153.92.2.13:143) open
1 Like

Thanks Miquel.

Probe from Docker termination and as you told me, I have no DNS problems. I resolve the IP address.

I tried to connect to the server with IP and I arrived, but I have certificate problems. Logically.

When I try to do it by FQDN, I get these errors.

Blockquote ERROR: connection timed out. timeout = 3000 ms

ConnectionTimeoutError: connection timed out. timeout = 3000 ms
    at Connection.imapOnError (/usr/local/lib/node_modules/n8n/node_modules/imap-simple/lib/imapSimple.js:544:23)
    at Object.onceWrapper (events.js:417:26)
    at Connection.emit (events.js:310:20)
    at Timeout._onTimeout (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:141:12)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)

Blockquote

Hi @Santiago_Fernandez

Issue is related with connection timeout (imap server is slow when accepting new clients).

Not sure if timeout can be greater on imap node by any option. @jan is this possible?

Hi @Santiago_Fernandez,
Presumably you’re not still facing this issue after about a year, but for others that may come across.
I was encountering the same error message, and discovered that the issue in my case was that when copy/pasting the host name into n8n, there was a ‘trailing’ space after the host. Not very easy to see. But that resolved the issue for me. I was able even able to reproduce the error message when I put the space back.

Also, @jan, typically a trailing space from a field would be omitted or otherwise not interfere in backend, so perhaps it’s something you may want to look at.

1 Like

trailing space still an issue in Aug 2023

Hey @cnvs,

That is interesting, Which field had the trailing space in it? I can get this fixed now.

when adding a credential for imap or smtp
if there is a trailing space in the host field then you see this error

getaddrinfo ENOTFOUND

Hey @cnvs,

Perfect I will fix that today.

I have just put in a quick PR to fix this which can be found below, Once reviewed and merged it will be available in a future release.

2 Likes

New version [email protected] got released which includes the GitHub PR 6886.

I just had the same problem and spent hours of work to realize I had a trailing space before the string. " smtp.hostinger.com". I guess you guys could make a PR to catch this problem as well.

1 Like

Hey @Eduardo_Chaves,

Welcome to the community :cake:

Which version of n8n are you running? The change made should remove whitespace from both sides of the host.

1 Like

Hi Jon,

Yea, now I realized that I was using an old version of n8n. That’s why.

3 Likes