Debugging problems with email-sending is really annoying. To get to root of the problem, it’s good to start with a very simple base. For SMTP this usually ends up being netcat’ing or telnet’ing into the mail server and sending the usual commands by hand, looking at the responses on each step.

But sometimes the server requires SSL/TLS connections before allowing you to send mails. OpenSSL has a built-in “netcat with TLS” called s_client.

Using STARTTLS

openssl s_client -starttls smtp -crlf -connect example.com:25