1
Mailer Error: SMTP Error: Could not connect to SMTP host.;PHPMailer:Godaddy上的SMTP主機連接錯誤
當我在godaddy中運行此代碼時,會生成此錯誤。
<?php
require("PHPMailer_5.2.0/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtpout.secureserver.net"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "******"; // SMTP password
$mail->From = "[email protected]";
$mail->FromName = "User";
$mail->AddAddress("[email protected]"); // name is optional
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if (!$mail->Send()) {
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
我相信你有聯繫GoDaddy的支持。 –
也許godaddy阻止tcp/25端口(SMTP)上的傳出流量。 –
$ mail-> Port? 傳出端口 沒有SSL - 以下之一:25,80,3535,587 使用SSL - 465 –