我已经接管了我公司网站的开发,但有一个密码重置表单不起作用,我无法弄清楚。它使用 PHPMailer 向用户的电子邮件地址发送重置密钥。php 查询数据库正常,并返回用户的正确电子邮件地址和重置密钥。
<?php
require_once('./library.php');
require_once('./PHPMailer/class.phpmailer.php');
$Trader = new CompanyTrader();
$resetdata = $Trader->resetTrader($_GET['name']);
print_arr($resetdata);
$reset = new PHPMailer(true);
$reset->IsSMTP();
try {
$reset->Host = EM_HOST;
$reset->SMTPDebug = 2; //2 to debug
$reset->SMTPAuth = EM_AUTH;
$reset->AddReplyTo(CONFIRM_REPLY_EMAIL, 'Company');
$reset->AddAddress($resetdata['traders_email_add'], $resetdata['traders_cont_name']);
$reset->SetFrom(CONFIRM_REPLY_EMAIL, 'Company');
$reset->Subject = 'Company Account Password Reset';
$reset->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$body = file_get_contents('./templates/reset_email.html');
$body = eregi_replace("\[USER_NAME\]", $resetdata['traders_user_name'], $body);
$body = eregi_replace("\[RESET_KEY\]", $resetdata['traders_reset'], $body);
$reset->MsgHTML($body);
$reset->Send();
} catch (phpmailerException $e) {
@log_this("Pass Reset Sending Failed: ".$e->errorMessage(),"email");
return false;
} catch (Exception $e) {
@log_this("Pass Reset Sending Failed: ".$e->getMessage(),"email");
return false;
}
?>
PHPMailer 返回错误如下
SMTP -> FROM SERVER:220-78.109.170.70.srvlist.ukfast.net ESMTP Exim 4.80 #2 Wed, 26 Dec 2012 21:41:58 +0000 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
SMTP -> FROM SERVER: 250-78.109.170.70.srvlist.ukfast.net Hello localhost.localdomain [127.0.0.1] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP
SMTP -> FROM SERVER:250 OK
SMTP -> FROM SERVER:250 Accepted
SMTP -> FROM SERVER:354 Enter message, ending with "." on a line by itself
SMTP -> FROM SERVER:250 OK id=1Tnyje-0000Kh-IL
我搞不定。是因为主机限制了我们可以发送的电子邮件数量吗?如果是这样,所有其他 PHPMailer 表单都可以工作,并且整个站点的所有设置都是相同的。谢谢。