Connection refused (111)SMTP connect() failed. code example
Example: SMTP -> ERROR: Failed to connect to server: Connection refused (111)SMTP Connect() failed.
<?php
include "emails/PHPMailer/PHPMailerAutoload.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->IsHTML(true);
$mail->Username = "@gmail.com";
$mail->Password = "";
$mail->setFrom('[email protected]', 'Zubair Mushtaq');
$mail->addReplyTo('[email protected]', 'Secure Developer');
$mail->addAddress('[email protected]', 'Abulogicss');
$mail->Subject = 'PHPMailer SMTP test';
$mail->msgHTML("convert HTML into a basic plain-text alternative body");
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}