Good morning everyone.
I am presented with the following error:
Uncaught Error: Call to a member function isSMTP ()
When I try to send an automatic email. I have reviewed in many forums and I have not been able to find the problem, I hope you can help me.
My code:
function enviarEmail($email, $nombre, $asunto, $cuerpo){
include "PHPMailer/PHPMailer.php";
include "PHPMailer/SMTP.php";
//$mail-> SMTPDebug = 2;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl'; //Modificado Brian
$mail->Host = 'smtp.gmail.com'; //Modificado Brian
$mail->Port = 465; //Modificado
$mail->Username = '[email protected]'; //Modificado Brian
$mail->Password = 'xxxx'; //Modificado Brian
$mail->setFrom('xxxx@gmail', 'Sistemas de Gestion'); //Modificado
$mail->addAddress($email, $nombre);
$mail->Subject = $asunto;
$mail->Body = $cuerpo;
$mail->IsHTML(true);
if($mail->send())
return true;
else
return false;
}
Thank you very much!