Replace the server name and the port. Usually the port will be 25. openssl s_client -connect <hostname>:<port> -starttls smtp eg: openssl s_client -connect smtp.office365.com:587 -starttls smtp Copy the output section of the certificate that looks like below. -----BEGIN CERTIFICATE----- ###bunch of encoded text### -----END CERTIFICATE----- You can copy it and save it to a file with ".crt" or ".cert" extension and that's the mail server's certificate. Make sure to include the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- lines. Note: OpenSSL is required. Ubuntu: sudo apt install openssl Other OSs: https://wiki.openssl.org/index.php/Binaries
Just another tech blog, also my personal blog. I'll be posting interesting articles about tech, programming and tricks, dev life, and any timely topics.