当我使用此脚本连接到同一域上的SMTP服务器时,它可以工作,但是当我将它用于远程SMTP时,它会出错
$mail->IsSMTP(); // send via SMTP
$mail->Host = "xxx.xxx.x"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "xxxxt@xxxxx.com"; // SMTP username
$mail->Password = "xxxxx"; // SMTP password
$mail->Port = 26;
$mail->SMTPDebug = 1;
$mail->From = "email@domain.com";
$mail->FromName = "Name";
$mail->AddAddress("xxxx.oxxk@gmail.com");
//$mail->AddReplyTo("yourname@domain.com","Your Name");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the <b>HTML body</b>";
$mail->AltBody = "This is the text-only body";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo“消息已发送”;
生成错误:
SMTP - &gt;错误:无法连接到服务器:连接被拒绝(111) SMTP错误:无法连接到SMTP主机。消息未发送
邮件程序错误:SMTP错误:无法连接到SMTP主机。
任何人都可以指出我错过了什么。
由于
答案 0 :(得分:0)
http://www.postcast.com/html/download.asp(从这里下载)
php.ini文件的更改