关于smtp发邮件,谁能帮忙看看 503 Error: need EHLO and AUTH first
Resolving SMTP server domain "smtp.qq.com"...
Connecting to host address "119.147.74.45" port 25...
Connected to SMTP server "smtp.qq.com".
S 220 esmtp4.qq.com Esmtp QQ Mail Server
C EHLO localhost
S 250-esmtp4.qq.com
S 250-PIPELINING
S 250-SIZE 52428800
S 250-AUTH LOGIN
S 250-AUTH=LOGIN
S 250 8BITMIME
C MAIL FROM:
C RCPT TO:
C DATA
S 503 Error: need EHLO and AUTH first !
Disconnected.
Cound not send the message to 276190536@qq.com. Error: 503 Error: need EHLO and AUTH first !
------解决方案--------------------
发送邮件前需要登陆
你有没有发登陆信息给smtp.qq.com服务器?
------解决方案--------------------
1) 检查你的QQ邮箱的POP/SMTP功能有没有打开?
2) 有可能你的程序多次登录,被QQ邮箱当作恶意登录给拒绝了,换其他邮箱发送试试看。
3) 贴出你的代码,要不然别人不知道怎么帮你检查
------解决方案--------------------
很可能是你的qq邮箱的设置错误..看看开通了pop3和smtp服务.
------解决方案--------------------
need EHLO and AUTH first !
这个不是说得很清楚了吗?
要先打招呼握手,并请求登陆。
if(!$fp=fsockopen($this->smtp['host'],$this->smtp['port'],$errno,$errstr)){
$this->message[]="连接邮件服务器失败,请检查:
1、服务器地址和端口是否设置正确!
2、网络是否通畅!";
return false;
}
if(strncmp(fgets($fp,512),'220',3)!=0){
$this->message[]="连接邮件服务器失败,请检查:
1、服务器地址和端口是否设置正确!
2、网络是否通畅!";
return false;
}
if($this->smtp['auth']){
fwrite($fp,"EHLO ".$this->smtp['posthost']."
");
while($rt=strtolower(fgets($fp,512))){
if(strpos($rt,"-")!==3 || empty($rt)){
break;
}elseif(strpos($rt,"2")!==0){
$this->message="与服务器招呼握手时错误";
return false;
}
}
fwrite($fp, "AUTH LOGIN
");
if(strncmp(fgets($fp,512),'334',3)!=0){
$this->message="提示服务器要登陆验证时错误";
return false;
}
fwrite($fp, base64_encode($this->smtp['user'])."
");
if(strncmp(fgets($fp,512),'334',3)!=0){
$this->message="SMTP AUTH LOGIN 验证 用户名 错误!";
return false;
}
fwrite($fp, base64_encode($this->smtp['pass'])."
");
if(strncmp(fgets($fp,512),'235',3)!=0){
$this->message="SMTP AUTH LOGIN 验证 密码 错误!";
return false;
}
} else{
fwrite($fp, "HELO ".$this->smtp['posthost']."
");
}
$from = $this->smtp['from'];
$from = preg_replace("/.*.*/", "\1", $from);
fwrite($fp, "MAIL FROM:
");
if(strncmp(fgets($fp,512),'250',3)!=0){
$this->message="发信人地址错误!";
return false;
}
fwrite($fp, "RCPT TO:
");
if(strncmp(fgets($fp,512),'250',3)!=0){
$this->message="收信人地址错误!";
return false;
}
fwrite($fp, "DATA
");
if(strncmp(fgets($fp,512),'354',3)!=0){
$this->message="邮件数据发送失败!";
return false;
}
$msg = "Date: ".date("r")."
";
$msg .= "Subject: $send_subject
";
$msg .= "$additional
";
$msg .= "$send_message
.
";
fwrite($fp, $msg);
$lastmessage = fgets($fp, 512);
if(substr($lastmessage, 0, 3) != 250){
$this->message="连接邮件服务器失败,请检查:
1、服务器地址和端口是否设置正确!
2、网络是否通畅!";
return false;
}
fwrite($fp, "QUIT
");
fclose($fp);
return true;
<div class="clear"></div>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号