Il est possible d'utiliser la commande openssl pour se connecter à un serveur STMP en utilisant la sécurité TLS,
Dans l'exemple suivant, l'option -CAfile /etc/ssl/certs/ca-certificates.crt permet d'indiquer l'autorité de certification dans le cas d'un certificat auto signé.
# openssl s_client -starttls smtp -crlf -CAfile /etc/ssl/certs/ca-certificates.crt -connect smtp.server.fr:25
CONNECTED(00000003)
depth=0 CN = localhost.localdomain
verify return:1
---
Certificate chain
0 s:/CN=localhost.localdomain
i:/CN=localhost.localdomain
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIBtzCCASACCQCupdgFIYzFVDANBgkqhkiG9w0BAQUFADAgMR4w
b2NhbGhvaW4wHhcNMTEwNDI2MTkxMDM1WhcNMjEwNDIzMTkx
MDM1WjAgMR4wHAYDVQQDExVsb2NhbGhvc3QubG9jYWxkb21ha
hvcNAQEBBQADgY0AMIGJZS3OcCHjbQNa++F/J4WGFk6r7ICl9Ls0
ybT+1CzbFG1xE71NeRhbHkLGigZa5422afsqq/b3LBIpMX17B/gtuo+
QKRckuo+20BUqHFye7ZAVXSsw+bqmm9D0vB4uw9IwyE75jEAqU1
QX7RAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAe1iHUXoGSTj3Fv3
2Yg1EFtNm/RSYxdHV8jY6W6CtwNatN+EQqmWlfhtOSCWgXriUjX5
E4uEocf6x/vDrVkpU11u+0xDUYshmrLyk2nmX6wbopwQttAE9PLw
ahQBiuj+sz38OW8=
-----END CERTIFICATE-----
subject=/CN=localhost.localdomain
issuer=/CN=localhost.localdomain
---
No client certificate CA names sent
---
SSL handshake has read 1021 bytes and written 456 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: D2A784125E749B8C74015978412B9B6E47DDA37BFB83FD4FEE8E6ED21BE79C92
Session-ID-ctx:
Master-Key: 631649B5A6A2F5272137C421AFB2F2E86CD483ED2FE8099BCDC9068A11EE7087F
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1478726847
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
250 DSN
mail from: one@mail.fr
250 2.1.0 Ok
rcpt to: two@mail.fr
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
from: one@mail.fr
to: two@mail.fr
subject: send mail with TLS connection
Voluptatem veniam quasi nisi voluptatum incidunt autem. Sed provident minus ab temporibus sed. Quia blanditiis consequatur assumenda aut hic. Minima cum qui quidem dicta velit quod voluptas. Dolorem aliquam animi consequatur.
Minima alias sint libero et. Et et in ratione similique iusto aut consectetur. Sed voluptatibus modi fuga ut quibusdam ut consectetur voluptas.
.
250 2.0.0 Ok: queued as 145A53700157
quit
221 2.0.0 Bye
closed
Très utile pour tester un serveur STMP