I am using this code to send emails using smtp:
require 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->Host = "sr4.supercp.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "********";
$mail->Password = "********";
$mail->SetFrom("********");
$mail->Subject = "Test";
$mail->Body = "hello";
$mail->AddAddress("****@gmail.com");
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
echo "<pre>";
echo print_r($mail);
}
else
{
echo "Message has been sent";
}
Getting this error:
2014-08-25 18:53:11 CLIENT -> SERVER: EHLO grabblaw.com
2014-08-25 18:53:11 SMTP ERROR: EHLO command failed:
2014-08-25 18:53:11 SMTP NOTICE: EOF caught while checking if connected SMTP connect() failed. Mailer Error: SMTP connect() failed.
I have spend entire day, but unable to make this work. Please help. Please refer this url for more error detailed info: http://grabblaw.com/mail_template.php