Testing SMTP + TLS + AUTH communication with cygwin or a linux machine

Ever felt the need to see what a mail server actually does when another mail server or a mail client (Thunderbird f.e.) connects to it? Easy to trace when the connection isn’t encrypted – but rarely happens today. So you will have to “play” mail client yourself from the command line, which turns out to be a bit tricky. An excellent article on the topic can be found here.

Quick summary:

You will either need access to a linux box or have cygwin installed – or have openssl windows binaries, but the Base64 stuff will be hard 😉 (Go ahead, just install cygwin, a serious admin cannot live without…!)

Step 1: create the authentication bits

replace “USERNAME123” and “PASSWORD456” with real data

Step2: connect to the mail server through openssl

Step3: after saying HELO or EHLO to mailserver, you have to authenticate

The part after the “PLAIN” is the token that was returned in Step 1.

If you get back some sort of 200+ return code from the mailserver, you can start babbling SMTP as usual.