About SMTP email, which expert can help to see 503 error:need EHLO and AUTH first

Source: Internet
Author: User
Tags smtp auth
About SMTP email, who can help see 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 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 8BITMIME
C MAIL from:<839325966@qq.com>
C RCPT to:<276190536@qq.com>
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!

------Solution--------------------
Login required before sending mail
Did you send a login message to the smtp.qq.com server?
------Solution--------------------
1) Check your QQ mailbox POP/SMTP function has not opened?
2) It is possible that your program multiple login, QQ mailbox as a malicious login to refuse, change other mailbox send try.
3) put out your code, or else people won't know how to help you check
------Solution--------------------
It is possible that your QQ mailbox is set incorrectly. See if the POP3 and SMTP services are enabled.
------Solution--------------------
Need EHLO and AUTH first!

Doesn't that make it clear?
To greet the handshake first, and request to login.

PHP Code
if (! $fp =fsockopen ($this->smtp[' host '), $this->smtp[' Port '], $errno, $errstr)) {$this->message[]= "connection mail server lost Fail, please check: \r\n1, server address and port are set correctly! \R\N2, network is unobstructed!            ";        return false; } if (strncmp ($fp, fgets), ' 3 ',!=0) {$this->message[]= "failed to connect to the mail server, please check: \r\n1, server address and port are set correctly! \R\N2, network is unobstructed!            ";        return false; } if ($this->smtp[' auth ') {fwrite ($fp, "EHLO". $this->smtp[' Posthost ']. "            \ r \ n ");                while ($rt =strtolower ($fp, fgets)) {if (Strpos ($rt, "-")!==3 | | empty ($RT)) {break;                    }elseif (Strpos ($rt, "2")!==0) {$this->message= "error in greeting handshake with server";                return false;            }} fwrite ($fp, "AUTH login\r\n");                if (strncmp ($fp, fgets, ' 334 ', 3)!=0) {$this->message= "prompt the server to log in to verify the error";            return false; } fwrite ($FP, Base64_encode ($this->smtp[' user ')."\ r \ n"); if (strncmp ($fp, fgets), ' 334 ', 3)!=0) {$this->message= "SMTP AUTH LOGIN authentication username Error!                ";            return false; } fwrite ($FP, Base64_encode ($this->smtp[' Pass '). "            \ r \ n "); if (strncmp ($fp, fgets), ' 235 ', 3)!=0) {$this->message= "SMTP AUTH LOGIN authentication password Error!                ";            return false; }} else{fwrite ($fp, "HELO". $this->smtp[' Posthost ']. "        \ r \ n ");        } $from = $this->smtp[' from ']; $from = Preg_replace ("/.*\< (. +?)        \>.*/"," \\1 ", $from);        Fwrite ($fp, "MAIL from: < $from >\r\n"); if (strncmp ($fp, fgets), ' 3 ',!=0) {$this->message= "sender address Error!            ";        return false;        } fwrite ($FP, "RCPT to: < $toemail >\r\n"); if (strncmp ($fp, fgets), ' 3 ',!=0) {$this->message= "the delivery address is incorrect!            ";        return false;        } fwrite ($fp, "data\r\n"); if (strncmp (fgets ($FP, 512), ' 354 ', 3) (!=0) {$this->message= "mail data send failed!            ";        return false; } $msg = "Date:". Date ("R"). "        \ r \ n ";        $msg. = "Subject: $send _subject\r\n";        $msg. = "$additional \ r \ n";        $msg. = "$send _message\r\n.\r\n";        Fwrite ($fp, $msg);        $lastmessage = fgets ($FP, 512); if (substr ($lastmessage, 0, 3)! =) {$this->message= "failed to connect to the mail server, check: \r\n1, server address and port are set correctly! \R\N2, network is unobstructed!            ";        return false;        } fwrite ($fp, "quit\r\n");        Fclose ($FP);  return true;
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.