Nextcloud Mail iCloud Setup Error

Hey guys, not sure if this is the right place to ask but I’m trying to play around with NextCloud Mail app on my selfhosted machine(at home) running NextCloud version 19 through the linuxserver nextcloud docker image. For context, my intention isn’t to make my own mail server but rather use iCloud mail server and connect that to the Nextcloud mail app and then later see if I can add my own domain as sender(through SendGrid) as I can on Thunderbird or eM Client for Windows.

So while setting up, I’m following the following guide from apple: https://support.apple.com/en-ca/HT202304 for the imap/smtp configurations and I keep on getting a “Request failed with status code 504” error. I’ve checked the log files and the issue seems to be with the IMAP server. I have tried to ping the imap server using telnet (telnet imap.mail.me.com 993) and there is a request so my host seems to be able to reach the url.

I’ve searched around and found a few things to try such as increasing timeout or setting verify tls peer option to false but nothing seems to be working.

Here are my log files/config file.

config.php extra stuff added

 'app.mail.verify-tls-peer' => false,
  'debug' => true,
  'log_type' => 'DEBUG',

horde_imap.log

>> Wed, 22 Jul 2020 17:26:54 +0000
>> Connection to: imap://imap.mail.me.com:993/
>> Slow Command: 20.159 seconds
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
------------------------------
>> Wed, 22 Jul 2020 21:05:07 +0000
>> Connection to: imap://imap.mail.me.com:993/
>> Slow Command: 80.22 seconds
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
------------------------------
>> Wed, 22 Jul 2020 21:08:06 +0000
>> Connection to: imap://imap.mail.me.com:993/
>> Slow Command: 80.356 seconds
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.
>> Connection failed: Error connecting to server.

Messages under the nextcloud.log are as follows:

{"reqId":"yCNhALCaDLiLHZPuX8cq","level":4,"time":"2020-07-22T21:08:10+00:00","remoteAddr":"xxxxxxIPHERExxxxxx","user":"42c300a2-56a8-103a-8ddd-5fb87c1872a4","app":"mail","method":"POST","url":"/apps/mail/api/accounts","message":"Creating account failed: Could not connect to IMAP: Error connecting to mail server.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36","version":"19.0.0.12"}

A horde_smtp.log has not been generated(I guess maybe because it errors out on imap step)

So looking forward to hearing your guys’ opinions/tips to get this working.
If I’m missing anything or you require some more answers please let me know!

Thanks in advance!

In fact Nextcloud is not only developed by guys! :eyes: https://www.hotjar.com/blog/gender-inclusive-language-workplace/

Is there a chance that your server is generally incapable of connecting to other servers on specific ports? Do you have any firewall in place that could cause this?