Dovecot cant connect to imaps 993

Solution

The problem was in fact a configuration issue, which was commented on by dovecot itself in /var/log/syslog:

Jan 14 17:34:23 mysite dovecot: imap-login: Fatal: Can't load ssl_cert: There is no valid PEM certificate. (You probably forgot '<' from ssl_cert=</etc/letsencrypt/live/mysite.com/fullchain.pem)

OLD Attempts

this output from telnet:

telnet mysite.com 993
Trying 127.0.1.1...
Connected to mysite.com.
Escape character is '^]'.
Connection closed by foreign host.

is what you would expect. port 993 is the SSL encrypted port for IMAP, so talking to this via telnet is rather hard ;-)

check if ie. thunderbird works with your settings - otherwise post the output of your mailclient and/or dovecot after a failed attempt.

EDIT: you can use openssl to connect to your IMAPS port. There is another question where this has been already answered in detail: https://stackoverflow.com/q/14959461/6591024

openssl s_client -connect mysite.com:993

as stated on the linked questions answers, you may be required to enforce CRLF by using openssl s_client -connect mysite.com:993 -crlf when using MacOS or Windows (perhaps?)