test a pop3 secure ssl port 995

i am trying to login to microsoft exchange online using openssl

openssl s_client -connect pop.mail.apac.microsoftonline.com:995

however when i pass the USER command it fails

+OK The Microsoft Exchange POP3 service is ready.
user [email protected]
-ERR Connection is closed. 12
read:errno=0

any ideas on how to test this?

more research

i tried

nc -v pop.mail.microsoftonline.com 995
Connection to pop.mail.microsoftonline.com 995 port [tcp/pop3s] succeeded!

user [email protected]

but no results...

fixed

openssl s_client -crlf -connect pop.mail.apac.microsoftonline.com:995

Solution 1:

You have to actually follow the POP3 protocol:

Commands ... consist of a case-insensitive keyword, possibly followed by one or more arguments. All commands are terminated by a CRLF pair. Keywords and arguments consist of printable ASCII characters. Keywords and arguments are each separated by a single SPACE character. Keywords are three or four characters long. Each argument may be up to 40 characters long.

Try passing -crlf to s_client.