I configured Mautic together with Amazon SES for sending out emails and used the standard email settings for receiving and parsing the “Unsubscribe Requests” and “Bounces” so the Mautic systems get a notion about unsubscribers and bounces (e.G. email adress not correct or existing any longer).
For a long time my Mautic installations seems to be fine. Recntly I saw some errors in the log files:
“Error communicating with the IMAP server: [CLOSED] IMAP connection broken (server response)”

When I tried the “Test connection and fetch folders” within “Email Settings” in the Mautic configuration, I got the same error message.

Turned out that the ip adress behind the MX record was proxied. I am using Cloudflare, and Cloudflare by default proxies the IP adress.
So this is what I got before
MX record
mydomain.com => mail.mydomain.com
A record
mail.mydomain.com => 12.1.12.2 (proxied)

I changed the A record to non-proxied and the problem got solved.