When sending emails from a server with a self-signed certificate, it's common to encounter the error "SSL3_GET_SERVER_CERTIFICATE:certificate verify failed." This issue arises due to SSL certificate verification introduced in PHP 5.6.
To address this problem, you have two options:
<code class="php">$mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) );</code>
However, it's crucial to note that disabling certificate verification can have security implications. Without proper authentication of SSL connections, attackers can impersonate trusted endpoints and perform man-in-the-middle attacks. Therefore, it's strongly recommended to secure your SSL certificate before implementing this workaround.
The above is the detailed content of How to Deal with \'SSL3_GET_SERVER_CERTIFICATE:certificate verify failed\' Error in PHPMailer?. For more information, please follow other related articles on the PHP Chinese website!