I have a mail delivering script running on various pages in my website for localhost XAMPP. It was working fine till last evening and as I started today again any page having phpmailer script gives error as
SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed.
I haven't changed anything into the local server configuration and my GMAIL credentials but unable to figure out possibly what has gone wrong into the SMTP settings so that this error is coming up. I have done all my settings neatly for this setup and as I said it was working well till last evening.
<?php
require('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$subject = "Test Mail using PHP mailer";
$content = "<b>This is a test mail using PHP mailer class.</b>";
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "ssl";
$mail->Debugoutput = 'html';
$mail->Port = 465;
$mail->Username = "emailsender@email.com";
$mail->Password = "*******";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->SetFrom("emailsender@email.com", "");
$mail->AddAddress("emailreceiver@email.com");
$mail->Subject = $subject;
$mail->WordWrap = 80;
$mail->MsgHTML($content);
$mail->IsHTML(true);
if(!$mail->Send())
echo "Problem on sending mail";
else
echo "Mail sent";
?>
I am just unable to find out any possible reason for this . Any help or advice will be appreciated.