[英]cannot connect to an smtp server over telnet error 504
嘗試通過telnet登錄到我的電子郵件服務器時出現504錯誤。 我嘗試過端口25和587。(使用* s和xs掩蓋域和ips)。
>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]
我可以用phpmailer做的很好!:
<?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();
並在身份驗證的后台進行:
public function Authenticate($username, $password) {
// Start authentication
fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
//...
如何在命令行上使用它?
這是因為大多數明智的郵件服務器都不允許未加密的AUTH-請注意,您從服務器接收的功能列表不包含AUTH-您需要先調用STARTTLS,PHPMailer會自動進行此操作。 您不能輕易地使用telnet手動完成此操作-使用openssl的s_client命令可以做得更好。 PHPMailer故障排除指南中有一個示例,如下所示:
openssl s_client -starttls smtp -connect smtp.outlook.office365.com:587
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.