问题描述
我正在使用PHP Mailer和Outlook SMTP发送SMTP错误。我在这里感到困惑,因为它在端口号为25的本地主机上工作正常,但是在主机服务器上不工作,我已尝试所有使用SSL& TLS。
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.
我的代码:
<?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 = "[email protected]";
$mail->Password = "password";
$mail->Priority = 1;
$mail->CharSet = 'UTF-8';
$mail->ContentType = 'text/html; charset=utf-8\r\n';
$mail->From = "[email protected]";
$mail->FromName = $name;
$mail->AddAddress("[email protected]");
$mail->IsHTML(true);
$mail->Subject = "You got Message from Website";
$mail->Body = "testing";
if(!$mail->Send())
{
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'success';
}
?>
请帮我解决这个问题。我有共享Linux托管。
Please help me to solve this issue. I have Shared Linux Hosting.
推荐答案
Mos可能不是您的主机支持的phpmailer。您必须通过创建新文件进行检查,并检查简单的PHP电子邮件功能。大多数情况下,SMTP在您的托管服务提供商处未配置
Mos probably phpmailer not supported by your hosting. You must have to cross check by creating new file and check simple php email function. Most probably SMTP not configure at your hosting provider
<?php
$to = "[email protected]";
$subject = "My subject";
$headers = "From: [email protected]" . "\r\n" .
"CC: [email protected]";
mail($to,$subject,$headers);
?>
这篇关于SMTP错误:无法连接到服务器:连接超时(110)与PHPMailer和Outlook SMTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!