William Costa Rodrigues - Site Developer

Site pessoal, com postagens, desenhos, códigos, informações sobre ciências e tecnologia.

Home Novidades Postagens
Categoria
Códigos adicionados no site: 18
Temas para Código

PHPMailer: SMTP Error: Could not connect to SMTP host

Palavras-chaves: PHP, PHPMailer, SMTP, Error | PHP
Cadastro: 27/09/2025 09:27:11 | Atualização: 28/09/2025 20:02:00
The PHPMailer wiki has a section on this:

https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#php-56-certificate-verification-failure

The suggested workaround is including the following piece of code:

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);

This should work for PHPMailer 5.2.10 (and up).

Note: Obviously, and also as suggested in that wiki, this should be a temporary solution!