my php mailer is working fine for last week but now not working and get this error message : SMTP -> ERROR: Failed to connect to server: Connection refused (111)
i don't know what is wrong ,i didn't change anything . i'm test send email in outlook with my email account the result is fine.
I am using PHPmailer Version: 2.0.4
Here my code :
<?php
$btnsubmit = $_REQUEST["btnSubmit"];
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->AddEmbeddedImage("images/img1.jpg", "img1", "img1.jpg");
$body = file_get_contents("promotion.html");
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->FromName = "Administrator";
$mail->Username = "newsletters@laroute-angkor.com";
$mail->Password = "*******";
$mail->Subject = "Promotions Tours to Beijing_4D3N_DEPART: 01-OCT-13";
$mail->IsHTML(true);
$mail->MsgHTML($body);
if( isset($_POST['btnSubmit']))
{
$mail->AddAddress("msymarina99@yahoo.com", "msymarina99");
$mail->Send();
echo("SENT COMPLETTED");
}
?>
I just got it working for me I had:
$mail->Host = "mail.drakecomfort.com";
$mail->SMTPSecure = "tls";
$mail->Port = 587;
changed it to
$mail->Host = "smtp.gmail.com";
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
final working code for me:
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = "true"; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "******@drakecomfort.com"; // GMAIL username
$mail->Password = "******"; // GMAIL password
$mail->SetFrom('*******@mycomputerstore.com', 'Debrief');
$mail->AddReplyTo("******@mycomputerstore.com","David Ingram");
$mail->Subject = "$subject";