Posted on 2011-09-23
SMTP Error: Could not connect to SMTP host. Message was not sent
Mailer Error: SMTP Error: Could not connect to SMTP host.
even though it was working a month ago ..
i am using gmail account with the phpmailer .
i am going crazy , all of the sudden something happened and made this not working ..
any ideas ?!
here is the php code :
$name = "Tester";
$sub ="New Assignment";
$mailer = new PHPMailer();
$mailer->Mailer = 'smtp';
$mailer->Port = 465;
$mailer->SMTPAuth = true;
$mailer->SMTPKeepAlive = true;
$mailer->Host = 'smtp.gmail.com';
$mailer->Username = 'email@example.com'; // Change this to your gmail adress
$mailer->Password = '123456'; // Change this to your gmail password
$mailer->From = $nameMail; // This HAVE TO be your gmail adress
$mailer->FromName = $name; // This is the from name in the email, you can put anything you like here
$mailer->Body = $body ;
$mailer->Subject = $sub;
$mailer->AddAddress($address); // This is where you put the email adress of the person you want to mail
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
echo "Message has been sent";
ofcourse there are the phpmailer class and the smtp class within the same folder .
as i said .. it was working before a short period of time .. but now it is not .