0
Hello, follow the code:
Inicia a classe PHPMailer
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.dominio.com";
$mail->Username = '[email protected]'; // Usuário do servidor SMTP
$mail->Password = 'senha123'; // Senha do servidor SMTP
$mail->From = "[email protected]";
$mail->FromName = "meu dominio";
$mail->AddAddress("meuemail","meunome");
$mail->IsHTML(true);
$mail->Subject = "Confirmação de pagamento";
$mail->Body = "meu email em html..";
$enviado = $mail->Send();
$mail->ClearAllRecipients();
$mail->ClearAttachments();
if ($enviado) {
echo "E-mail enviado com sucesso!";
} else {
echo "Não foi possível enviar o e-mail.<br /><br />";
echo "<b>Informações do erro:</b> <br />" . $mail->ErrorInfo;
}
Follow the error:
It was not possible to send the email.
Error message: SMTP connect() failed.Could not send the email.
Error information§ãµes: SMTP connect() failed.
Anyway, has this error ever occurred with anyone? And what was the reason? I already enabled the ssl line there in php.ini that I heard some say I needed..
Set door and security type in phpmailer?
– rray
I had not set, but I set it for testing purposes, but the error persisted. I set these two lines:
$mail->Port = 465;
$mail->SMTPAuth = true;
Thanks for the help lost.– Ale
Solved, the host was wrong, I mistook the domain as being a host, which is actually where the domain is hosted.. the door I used 587, thank you all!
– Ale
If your Script version is current, Phpmailer, your server is to be in version 5+ of PHP. Check this on your hosting.
– Lollipop
I understand, but the mistake in question was to confuse domain with hosting, I was putting there on the Host the domain of the site I was using, and it does not give hosting, and I also put the 587 post. I will mark it as useful, because in fact it is necessary to update there in the site CPANEL PHP.
– Ale