简体   繁体   English

PHPMailer-SMTP错误:密码命令失败

[英]PHPMailer - SMTP ERROR: Password command failed

So I would like to send a email via a smtp server but it won't work. 因此,我想通过smtp服务器发送电子邮件,但无法正常工作。

require_once "PHPMailer/class.phpmailer.php";
$mail = new PHPmailer();
$mail->SetLanguage("fr", "PHPMailer/language/");
$sujet = 'Hello World';
$texteHTML = 
'<html>
<body>
    <h1>Test envoi</h1>
</body>
</html>';
$mail->IsSMTP();
$mail->SMTPDebug = 3;

$mail->IsHTML(true);
$mail->Host= 'smtp.orange.fr'; // Serveur SMTP
$mail->From= '******@*****.fr';
  // Authentification
$mail->SMTPAuth=true;
$mail->Username = '*******';           // SMTP username
$mail->Password = ''; // The password is really empty, nada, nothing. Is it possible ?
$mail->Port = 25;
$adresse = '*****@gmail.com';
$mail->AddAddress($adresse);
$mail->Subject=$sujet;
$mail->Body=$texteHTML;
$erreur=false;
if(!$mail->Send())
{
    echo "PHPMailer - ";
    echo $mail->ErrorInfo; //Affiche le message d'erreur
    echo "";
    $erreur=true;
}
$mail->SmtpClose();
unset($mail);

And i get this error 我得到这个错误

2014-02-04 14:21:52 CLIENT -> SERVER:
2014-02-04 14:21:52 SERVER -> CLIENT: 501 5.7.0 invalid LOGIN encoding
2014-02-04 14:21:52 SMTP ERROR: Password command failed: 501 5.7.0 invalid LOGIN encoding
2014-02-04 14:21:52 CLIENT -> SERVER: QUIT

My login and password are right. 我的登录名和密码正确。 Does PHPMailer work if there is no password ? 如果没有密码,PHPMailer是否可以工作?

Thx for your time. 谢谢你的时间。

From your received answer: "invalid LOGIN encoding"... empty passwords decoded by that host results in something else than empty. 从您收到的答案中:“无效的LOGIN编码” ...该主机解码的空密码会导致空值。

Looking at class.smtp.php (line 245): 查看class.smtp.php(第245行):

fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);

your empty string is encoded 您的空字符串已编码

and line 256: 和第256行:

echo "SMTP -> ERROR: " . $this->error["error"] .": " . $rply . $this->CRLF;

indicates than the message is created from the host, not the program. 表示消息是从主机而不是程序创建的。

My guess is not, it is not possible use empty passwords. 我的猜测不是,不可能使用空密码。

BTW, I never saw an email account without a password. 顺便说一句,我从未见过没有密码的电子邮件帐户。

HIH, HIH,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM