PHP is always unsuccessful with mail ().

Source: Internet
Author: User
Tags pear
Mail () sendmail QQ Mail

 
  


Development environment with the WAMP, download and install the SendMail program, according to the online statement also changed the php.ini and Sendmail.ini
Use Foxmail 7.1 to create their own QQ mailbox account, opened the POP3/SMTP service. Change the outgoing sender server to POP3, using the same authentication as the receiving server. The result is an error: Warning:mail (): SMTP server response:503 error:need EHLO and AUTH first! In F:\PHP\wamp\www\mail.php on line 8
Do not know which place is wrong, ask the person of the meeting to instruct. Thank you!!!


Reply to discussion (solution)

Can try Phpmailer

$path = Realpath (dirname (__file__)). ' /..           /libraries/mail.php '; include ("$path");; $mail = new mail (); Creation of new objects $mail->issmtp (); $mail->smtpauth = True to send mail using SMTP;        What does SMTP need?? $mail->smtpsecure = "SSL";   Gmail's SMTP master needs SSL?? $mail->host = "smtp.gmail.com";        Gamil SMTP host?  $mail->port = 465;        SMTP port of the Gamil SMTP main? 465 ports. $mail->charset = "UTF-8";              ? $mail->username = "onlyfortestlzz@gmail.com";        ? fixed???? $mail->password = "ABCDE"; ???              Dense? $mail->from = "onlyfortestlzz@gmail.com"; ? mail $mail->fromname = "Working person?" The name of the sender $mail->subject = "Phpmailer??" Letter ";        ?       $mail->body = "Hello"; $mail->ishtml (TRUE); How to make a definite case? HTML $mail->addaddress ($this->input->post (' Backemail '), $value->username);                                 What is the name of the recipient?                                if (! $mail->send ()) {echo ' OK ';                            }                 

It is recommended to use pear, install the following three:
(1), Mail
(2), NET_SMTP
(3), Mail_mime

The mail () function did not succeed because there was no
$mail->host = "smtp.gmail.com"; Gamil SMTP host?
That is, it is not sent from an account.
The message sent by this function is considered by the receiving server to be junk mail thrown away. Note that spam in the mailbox is not very junk. And it's just thrown away.
PHP uses Phpmailer, and a few use pear.

The Mail function can only use its own configured SMTP server that does not require user authentication
If your SMTP is not recognized by the E-Mail alliance, messages sent will be processed as spam

Can try Phpmailer

$path = Realpath (dirname (__file__)). ' /..           /libraries/mail.php '; include ("$path");; $mail = new mail (); Creation of new objects $mail->issmtp (); $mail->smtpauth = True to send mail using SMTP;        What does SMTP need?? $mail->smtpsecure = "SSL";   Gmail's SMTP master needs SSL?? $mail->host = "smtp.gmail.com";        Gamil SMTP host?  $mail->port = 465;        SMTP port of the Gamil SMTP main? 465 ports. $mail->charset = "UTF-8";              ? $mail->username = "onlyfortestlzz@gmail.com";        ? fixed???? $mail->password = "ABCDE"; ???              Dense? $mail->from = "onlyfortestlzz@gmail.com"; ? mail $mail->fromname = "Working person?" The name of the sender $mail->subject = "Phpmailer??" Letter ";        ?       $mail->body = "Hello"; $mail->ishtml (TRUE); How to make a definite case? HTML $mail->addaddress ($this->input->post (' Backemail '), $value->username);                                 What is the name of the recipient?                                if (! $mail->send ()) {echo ' OK ';                            }                 
Thank you. The use of Phpmailer has been resolved.
  • 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.