【发布时间】:2014-06-24 16:07:52
【问题描述】:
我正在尝试使用 phpMailer 发送电子邮件。
我已下载文件并将其放入“path2”。
php 程序有 3 个输入:$email、$subject 和 $body。
这是运行时的错误代码:
2014-06-24 15:48:18 SMTP ERROR: Failed to connect to server: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) SMTP connect() failed. Mailer Error: SMTP connect() failed.
这是我的代码:
<?php
require_once("..\path2\class.phpmailer.php");
date_default_timezone_set('America/Eastern');
include("..\path2\class.smtp.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = True;
$mail->SMTPSecure = "SSL";
$mail->Host = "smtp.live.com";
$mail->Port = 465;
$mail->Username = "self@live.com";
$mail->Password = "pass1";
$mail->From="self@live.com";
$mail->Subject = $subject;
$mail->Body=$body;
$mail->AddAddress($email);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
【问题讨论】:
-
你可以尝试从你的服务器使用telnet命令,看看是网络错误还是你的php代码错误。
-
telnet cmd 的详细信息?
-
具体是什么意思?
-
他在请求命令。