doumeitang572461 2014-02-04 14:32
浏览 140
已采纳

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

So I would like to send a email via a smtp server but it won't work.

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 ?

Thx for your time.

  • 写回答

1条回答 默认 最新

  • duanliushua5026 2014-02-04 14:52
    关注

    From your received answer: "invalid LOGIN encoding"... empty passwords decoded by that host results in something else than empty.

    Looking at class.smtp.php (line 245):

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

    your empty string is encoded

    and line 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,

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵