In the end the answer was fairly simple, I had to remove the
-crlf parameter, so the command to start openssl hast to be in my case:
openssl s_client -connect imap.gmail.com:993
I discovered that rather by accident, copying a command I used on a different server. Feel free to write a comment if you have other experiences.
Since I don't have enough time at the moment to dive further into this topic, I'll gladly accept a better answer if you know what exactly is going on in the background (especially if you know a way to figure out the right flags without using trail and error).
Note: A false
-crlf flag used servers that are configured more strictly then google's IMAP doesn't even let you use the login command anymore (e.g. Strato returns:
. BAD [CLIENTBUG] Too many parameters)
Note2: Don't forget to turn on IMAP and activate access for less secure clients otherwise you won't be able to log in.