I am getting SMTP Error with PHP Mailer and Outlook SMTP. I am confused here because it is working fine on localhost with Port number 25 but It is not working on Hosting Server, I have tried all ports with SSL & TLS.
Error : SMTP ERROR: Failed to connect to server: Connection timed out (110)
My Code:
<?php
include("PHPMailer.php");
error_reporting(E_ALL);
ini_set('display_errors', '1');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.live.com";
$mail->SMTPDebug = 2;
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Username = "info@neelcomputech.com";
$mail->Password = "password";
$mail->Priority = 1;
$mail->CharSet = 'UTF-8';
$mail->ContentType = 'text/html; charset=utf-8
';
$mail->From = "info@neelcomputech.com";
$mail->FromName = $name;
$mail->AddAddress("info@neelcomputech.com");
$mail->IsHTML(true);
$mail->Subject = "You got Message from Website";
$mail->Body = "testing";
if(!$mail->Send())
{
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'success';
}
?>
Please help me to solve this issue. I have Shared Linux Hosting.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…