当使用phpmailer功能时,我会收到错误消息。我正在使用php5,下面是我使用的代码。
require_once("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->Host = 'mail.mydomain.com';
$mail->Port = 21;
$mail->Username = xxx;
$mail->Password = xxx;
$mail->SetFrom($email, $firstname . " " . $lastname);
$mail->AddAddress($contact);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->WordWrap = 50;
$mail->isHTML(true);
$mail->Send();
if(!$mail->Send())
{
echo "email_has_not_been_sent <br><br>";
echo "Mailer Error: " . $mail->ErrorInfo;
$IsSent = 0;
exit;
}以下是错误消息。
SMTP -> ERROR: EHLO not accepted from server: 500 EHLO not understood
SMTP -> ERROR: HELO not accepted from server: 500 HELO not understood
SMTP -> ERROR: AUTH not accepted from server: 500 AUTH not understood
SMTP -> ERROR: RSET failed: 500 RSET not understood
SMTP Error: Could not authenticate. SMTP -> ERROR: MAIL not accepted from server: 500 MAIL not understood发布于 2013-04-17 09:43:46
您的代码看起来不错,但我认为您使用的端口更常用于FTP.25和587是更常用的SMTP端口。
一些基本的电视节目应该告诉你发生了什么:
telnet smtp.gmail.com 587然后输入命令EHLO,您将看到gmail服务器的欢迎消息。
现在在你的服务器上试一试,你会看到你得到了什么
然后,对更常见的SMTP端口尝试相同的方法:25和587,您应该会看到其中的不同之处。
https://stackoverflow.com/questions/16054380
复制相似问题