我嘗試谷歌所有早上,我想我現在需要Stackoverflow!PHPMailer錯誤:SMTP - >錯誤:無法連接到服務器
我寫了一個簡單的腳本來發送郵件(從Hotmail到Gmail) ,但我得到這個錯誤:
SMTP - >錯誤:無法連接到服務器:連接嘗試失敗,因爲連接的方沒有一段時間後沒有正確響應,或者由於連接的主機未能響應而建立的連接失敗。 (10060)SMTP連接()失敗。錯誤
這是代碼:
<?php
require_once("../includes/phpMailer/class.phpMailer.php");
require_once("../includes/phpMailer/class.smtp.php");
$to_name = "RECEIVER NAME";
$to = "[email protected]";
$subject = "Mail test at " . strftime("%T", time());
$message = "This is a test message";
$message = wordwrap($message, 70);
$from_name = "MY NAME";
$from = "[email protected]";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = "smtp.live.com";
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = "MY USERNAME (hotmail)";
$mail->Password = "MY PASSWORD (hotmail)";
$mail->FromName = $from_name;
$mail->From = $from;
$mail->AddAddress($to, $to_name);
$mail->Subject = $subject;
$mail->Body = $message;
$result = $mail->Send();
echo $result ? 'Sent' : 'Error';
?>
另一個信息是,甚至沒有標準郵件()函數的工作,並檢查PHP的信息,我發現這個:
sendmail_from - MY正確的郵件(Hotmail的)
sendmail_path - 沒有值
SMTP - 本地主機
smtp_port - 25
謝謝!
是您的託管公司/ isp阻塞端口? – fortune