# How to verify that SSL for IMAP/SMTP works and a proper SSL certificate is in use

<p class="callout info">Credit [Robert Asibekov](https://support.plesk.com/hc/en-us/articles/213961665-How-to-verify-that-SSL-for-IMAP-POP3-SMTP-works-and-a-proper-SSL-certificate-is-in-use)</p>

#### IMAP via SSL using port 993

- connect to a mail server using openssl:

```
openssl s_client -showcerts -connect mail.example.com:993 -servername mail.example.com
```

- Check output and make sure that a valid certificate is shown:

```
Server certificate
subject=/OU=Domain Control Validated/OU=PositiveSSL/CN=mail.example.com
issuer=/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=PositiveSSL CA 2
```

- Make sure that you received IMAP server response:

```
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=PLAIN IDLE ACL ACL2=UNION] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.
```

#### SMTP via TLS/StartTLS using port 25 or 587

- Connect to a mail server using openssl:

```
openssl s_client -starttls smtp -showcerts -connect mail.example.com:25 -servername mail.example.com
```

- Check output and make sure that a valid certificate is shown:

```
Server certificate
subject=/OU=Domain Control Validated/OU=PositiveSSL/CN=mail.example.com
issuer=/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=PositiveSSL CA 2
```

- Make sure that you received SMTP server response:

```
250 DSN
```