Problem


While attempting to establish a secure SMTP connection using SSL or STARTTLS, the application may fail with the following error:


SSL operation failed with code 1 OpenSSL Error: error:0A000086:SSL routines::certificate verify failed


This error indicates that the application or server is unable to verify the SSL certificate presented by the mail server during the SSL/TLS handshake.


Cause


This issue occurs when the Certificate Authority (CA) that issued the mail server’s SSL certificate is not present or not trusted in the system’s trusted certificate store.


As a result, OpenSSL cannot validate the certificate chain and rejects the secure connection.


This is a known OpenSSL behavior and is documented here:
https://stackoverflow.com/questions/75013468/phpmailer-could-not-connect-to-smtp-host-stream-socket-enable-crypto-openssl


Solution

Install the required CA certificate or CA bundle in the system’s trusted certificate store.

Solution – Windows Server

  1. Press Win + R, type mmc, and press Enter

  2. Go to File → Add/Remove Snap-in

  3. Select Certificates and click Add

  4. Choose Computer accountLocal computer 

  5. Navigate to: Certificates (Local Computer) → Trusted Root Certification Authorities → Certificates

  6. Right-click and select All Tasks → Import

  7. Import the provided CA certificate / CA bundle

  8. Restart the application or related services


Solution – Linux Server (Ubuntu / Debian)

  1. Copy the CA certificate or CA bundle to the server

  2. Place the file in:

    /usr/local/share/ca-certificates/
  3. Update the trusted CA store:

    sudo update-ca-certificates
  4. Restart the application or related services


Solution – Linux Server (RHEL / CentOS)

  1. Copy the CA certificate or CA bundle to:

    /etc/pki/ca-trust/source/anchors/
  2. Update the CA trust store:

    sudo update-ca-trust
  3. Restart the application or related services



Notes

  • Ensure the system date and time are correctly configured

  • Restarting the application is required for the changes to take effect