Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have an Exchange 2007 server running on Windows Server 2008. Our client uses another vendor's mail server. Their security policies require us to use enforced TLS. This was working fine until recently.

Now, when Exchange tries to deliver mail to the client's server, it logs the following:

A secure connection to domain-secured domain '' on connector 'Default external mail' could not be established because the validation of the Transport Layer Security (TLS) certificate for failed with status 'UntrustedRoot. Contact the administrator of to resolve the problem, or remove the domain from the domain-secured list.

Removing from the TLSSendDomainSecureList causes messages to be delivered successfully using opportunistic TLS, but this is a temporary workaround at best.

The client is an extremely large, security-sensitive international corporation. Our IT contact there claims to be unaware of any changes to their TLS certificate. I have asked him repeatedly to please identify the authority that generated the certificate so that I can troubleshoot the validation error, but so far he has been unable to provide an answer. For all I know, our client could have replaced their valid TLS certificate with one from an in-house certificate authority.

Does anyone know a way to manually inspect a remote SMTP server's TLS certificate, as one can do for a remote HTTPS server's certificate in a web browser? It could be very helpful to determine who issued the certificate and compare that information against the list of trusted root certificates on our Exchange server.

share|improve this question
up vote 42 down vote accepted

You can use OpenSSL. If you have to check the certificate with STARTTLS, then just do

openssl s_client -connect -starttls smtp

or for a standard secure smtp port:

openssl s_client -connect
share|improve this answer
Beautiful. Similar validation errors in OpenSSL, but a lot more detail. Now we know that the problem isn't limited to our mail server. – Skyhawk Apr 12 '10 at 15:53
@Miles: If you are trying this on Windows, don't forget that openssl does not support using the Windows certificate store, so it will always fail validation. – grawity Apr 12 '10 at 19:49
Thanks Grawity. I did run OpenSSL on a Linux box, and so far as I can tell, the default configuration does include the root certificate for the certificate vendor (VeriSign). – Skyhawk Apr 12 '10 at 20:56
How can I see the servers certificate expiration date? – nimrodm Dec 21 '13 at 18:16
@nimrodm: pipe the cert to "openssl x509 -text" – Dan Andreatta Jan 6 '14 at 14:58

If you don't have OpenSSL, you can also use this Python snippet:

import smtplib
import ssl

connection = smtplib.SMTP() 
print ssl.DER_cert_to_PEM_cert(connection.sock.getpeercert(binary_form=True))

where [hostname] is the server.


This pulls the OpenSSL library for you, which makes the install a bit easier.

share|improve this answer
From the Python ssl module documentation: "This module uses the OpenSSL library." So this answer is a little misleading in terms of what is going on. – fbmd Jul 19 at 13:41
@fbmd Thanks for the feedback. Is this edit better (see last sentence)? – browly Jul 19 at 15:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.