Mail servers often start in plain text and switch to TLS afterwards, so a plain TLS check against port 587 just hangs. OpenSSL knows the handshake.
The -starttls option of openssl s_client sends the protocol-specific messages needed to switch to TLS. The documented protocols are smtp, pop3, imap, ftp, xmpp, xmpp-server, irc, postgres, mysql, lmtp, nntp, sieve and ldap.
openssl s_client -starttls smtp -connect mail.example.com:587 -servername mail.example.com -brief
-connect gives host and port. -servername sets the SNI name, and when you leave it out, it is taken from the -connect host if that looks like a DNS name. -brief prints a short summary of the connection parameters instead of the full output.
Other protocols work the same way:
openssl s_client -starttls imap -connect mail.example.com:143 -brief
After the summary, the command waits for input. Type Q to end the connection, or press Ctrl-D, because end of input closes it too. To read only the certificate dates, close stdin with </dev/null and pass the output to openssl x509:
openssl s_client -starttls smtp -connect mail.example.com:587 </dev/null 2>/dev/null | openssl x509 -noout -dates
Port 465 usually starts TLS right away, so leave -starttls out there. Some home networks also block outgoing port 25, so for a quick test from home, 587 or 143 is more likely to answer.
Further reading: openssl-s_client