简体   繁体   中英

PHPMailer - SMTP ERROR: Password command failed

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.

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,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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