Reputation: 19573
I am getting a 504 error when trying to log in to my email server over telnet. I have tried ports 25 as well as 587. (Masking domains and ips with *s and xs).
>EHLO domain.com
250-************.outlook.office365.com Hello [xx.xx.xx.xx]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250 CHUNKING
> HELP
214-This server supports the following commands:
214 HELO EHLO STARTTLS RCPT DATA RSET MAIL QUIT HELP AUTH BDAT
> AUTH
504 5.7.4 Unrecognized authentication type
[*************.********.****.outlook.com]
> auth
504 5.7.4 Unrecognized authentication type
[*************.********.****.outlook.com]
> AUTH LOGIN
504 5.7.4 Unrecognized authentication type
[*************.********.****.outlook.com]
> auth login
504 5.7.4 Unrecognized authentication type
[*************.********.****.outlook.com]
I can do it just fine using phpmailer though!:
<?php
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->Host = $host;
$mail->Port = 587;
$mail->SMTPDebug = 2;
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true;
$mail->Username = $user;
$mail->Password = $password;
$mail->SetFrom($user, "chiliNUT");
$mail->Subject = $subject;
$mail->MsgHTML($content);
$mail->send();
And under the hood for auth it is doing:
public function Authenticate($username, $password) {
// Start authentication
fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
//...
How can I get this working on the command line?
Upvotes: 1
Views: 7194
Reputation: 37810
It's because most sensible mail servers do not permit unencrypted AUTH - note that the capability list you receive from the server does not include AUTH - you need to call STARTTLS first, which PHPMailer does automatically. You can't easily do this manually with telnet - use openssl's s_client command to do it better. There's an example in the PHPMailer troubleshooting guide, something like:
openssl s_client -starttls smtp -connect smtp.outlook.office365.com:587
Upvotes: 2