openssl s_client -connect imap.gmail.com:993 > gmail-imap-cert.pem Open the file you retrieved with OpenSSL – gmail-imap-cert.pem in my case – in an editor (such as vi). Remove all the lines before ...