mokatell
asked on
php mailer
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 :
<?php
require("class.phpmailer.p hp");
$name = "Tester";
$nameMail ="DummyText";
$body ="helllllo";
$sub ="New Assignment";
$address ="abc@hotmail.com";
$mailer = new PHPMailer();
$mailer->Mailer = 'smtp';
$mailer->IsSMTP();
$mailer->IsHTML(true);
$mailer->Port = 465;
$mailer->SMTPSecure='ssl';
$mailer->SMTPAuth = true;
$mailer->SMTPKeepAlive = true;
$mailer->Host = 'smtp.gmail.com';
$mailer->Username = 'mymail@gmail.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($addre ss); // This is where you put the email adress of the person you want to mail
if(!$mailer->Send())
{
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
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 .
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 :
<?php
require("class.phpmailer.p
$name = "Tester";
$nameMail ="DummyText";
$body ="helllllo";
$sub ="New Assignment";
$address ="abc@hotmail.com";
$mailer = new PHPMailer();
$mailer->Mailer = 'smtp';
$mailer->IsSMTP();
$mailer->IsHTML(true);
$mailer->Port = 465;
$mailer->SMTPSecure='ssl';
$mailer->SMTPAuth = true;
$mailer->SMTPKeepAlive = true;
$mailer->Host = 'smtp.gmail.com';
$mailer->Username = 'mymail@gmail.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($addre
if(!$mailer->Send())
{
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
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 .
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.