PhpMailer SMTP NOTICE: EOF caught while checking if connected

I got an issue with phpMailer, i can’t send any e-mail, and it gives me this error:

2016-03-03 21:32:09 SERVER -> CLIENT: 2016-03-03 21:32:09 SMTP NOTICE: EOF caught while checking if connected 2016-03-03 21:32:09 SMTP Error: Could not authenticate. 2016-03-03 21:32:09 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Erreur : SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

This is my code :

<?php require('phpmailer/PHPMailerAutoload.php'); 
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'ssl://smtp.gmail.com';
$mail->SMTPAuth= true;
$mail->Username='[email protected]';
$mail->Password='passwordgmail';
$mail->Port = 587; 
$mail->SMTPDebug = 2; 
$mail->SMTPSecure = 'ssl';
$mail->SetFrom('[email protected]', 'Name');
$mail->AddAddress('[email protected]', 'HisName');
$mail->Subject = 'Subject';
$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail    clients";
if(!$mail->Send()) {
echo 'Error : ' . $mail->ErrorInfo;
} else {
    echo 'Ok!!';
  } 
?>

I tried all the answers i found, but none of them worked so far. I also tried other ports, the 25 and 465 don’t work and give me other errors. If someone could help me please it would be really nice =) . Thank you

Leave a Comment

tech