0

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.

2
  • Are you sure to don't have password for smtp.orange.fr ??????? Commented Feb 4, 2014 at 14:42
  • @JTeisseire yeah i'm sure, no password...
    – Roadirsh
    Commented Feb 4, 2014 at 14:48

1 Answer 1

1

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,

1
  • That's right, thanks. I can't make +1 but i would if i could :D
    – Roadirsh
    Commented Feb 4, 2014 at 15:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.