Cannot get mails via IMAP


I would like to get mails like mail client does. I tried via evolution (Linux mail client) and it works, but I do sth wrong when try do same in n8n.

This is config in mail client:
And this is what I provide to n8n:

My node:

N8N error:

ERROR: 139865388739912:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

Error details:

Error: 139865388739912:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

    at Socket.ondata (internal/js_stream_socket.js:77:22)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

I do this first time, so is my way correct or is just not possibly or sth?

Thank you in advance :>

Hi @Shirobachi, I am sorry to hear you’re encountering this problem. I am not super familiar with IMAP security, but it seems in your email client you are using a STARTTLS encryption (which uses an insecure connection to start with and then negotiates an upgrade to a secure connection). In n8n you have selected SSL/TLS which requires a secure connection to start but which your server doesn’t seem to offer. So what happens here is that n8n would try to establish a secure connection to your IMAP server but this attempt ultimately fails.

Now from my understanding STARTTLS is no longer recommended by the Internet Engineering Task Force and is not supported by n8n’s IMAP credentials.

Therefore my suggestion would be to check if your email provider offers SSL/TLS connections (possibly through a different port as 993 would be the default port for encrypted IMAP) or sign up for an alternative email provider for your n8n use case.

I hope this makes sense and clarifies! Please do let me know if you have any further queries.


Thanks for that explanation, I did not know that difference b/w STARTTLS and SSL/TLS.

I checked it, and it worked, but TBH very weird loading.
#1: I mean that when I pass creds to evolution (mail client) it takes like max 1 second. The very same creds in n8n can take even minute with no result. At the beginning I got some result, so I can say that:

#2: I had in mailbox 3 mails, one new unread other old maked as read, and only new one was returned by n8n. How it exactly work? I mean, I know that it’s trigger node, but it’s returning only one the newest or somehow else?

I activated it and it work in background properly by now

My node:


For your question 1: This wouldn’t usually happen when using the IMAP trigger node - it opens a connection and then triggers whenever new mail arrives.

However, there could be a wait whenever the connection gets interrupted. You could configure your logging to see verbose output like this to verify this.

For your second question: That’s the default behaviour - it triggers for new, unseen mails and ignores other messages in your inbox (which could also cause the behavior from your first question when your email client is marking messages as seen automatically). You can customize this behaviour under Options → Custom email rules:


The node uses this module under the hood, so you’d need to familiarize yourself with the respective search functionality in case you want to adjust this behaviour.