【发布时间】:2011-09-06 20:24:41
【问题描述】:
我在本地网络服务器上设置 phpmailer 时遇到困难,希望能提供任何帮助
我正在运行 xamppp 1.7.4 和 php 5.3.5 - 每当尝试发送邮件时,我都会收到以下错误消息
SMTP Error: Could not connect to SMTP host.
这是我现在使用的代码
require("resources/phpmailer/class.phpmailer.php");
//send the email with an email containing the activation link to the supplied email address
$mailer = new PHPMailer();
$mailer->IsSMTP(); // telling the class to use SMTP
$mailer->Mailer = "smtp";
$mailer->Host = "ssl://smtp.gmail.com";
$mailer->Port = 587;
$mailer->SMTPAuth = true; // turn on SMTP authentication
$mailer->Username = $email_kite;
$mailer->Password = $emailpass_kite;
$mailer->From = $email_kite;
$mailer->FromName = 'Kite';
$mailer->Body = 'Testing';
$mailer->Subject = 'Get started with Kite';
$mailer->AddAddress($email);
if(!$mailer->Send())
{
// message not sent
echo '<p class="c7">Unfortunately the <b>activation</b> email could not be sent and user registration has failed. Please go <a href="register.php">back</a> and try again.</p>';
echo '<br><img src="resources/img/spacer.gif" alt="" width="1" height="10">';
include_once ("resources/php/footer.php");
exit;
}
else
{
// message sent
"Email sent successfully!";
}
}
谢谢!
【问题讨论】:
-
不,我不这么认为。如果没有加载 dll,我认为它不会生成该消息。我真的认为这是港口。即使 dll 没有被加载,那肯定会阻止它工作。
标签: phpmailer