我正在使用PHP Mailer和Outlook SMTP获得SMTP错误.我在这里很困惑,因为它在端口号为25的localhost上工作正常,但它不能在Hosting Server上工作,我已尝试使用SSL和TLS的所有端口.
错误: SMTP错误:无法连接到服务器:连接超时(110)
我的代码:
<?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\r\n';
$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';
}
?>
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.我有共享Linux主机.