Mail () in PHP is always unsuccessful. Mail () sendmail QQ mailbox
Wamp used in the development environment, download and install the sendmail program, and change php. ini and sendmail. ini according to the Internet.
Foxmail 7.1 is used to create an account for your QQ mailbox and the POP3/SMTP service is enabled. Change the sending server to POP3 and use the same authentication as the receiving server. The result still reports the following Error: Warning: mail (): SMTP server response: 503 Error: need EHLO and AUTH first! In F: \ PHP \ wamp \ www \ mail. php on line 8
I don't know where it is wrong. please kindly advise. Thank you !!!
Reply to discussion (solution)
You can try phpmailer.
$ Path = realpath (dirname (_ FILE __)). '/.. /libraries/Mail. php '; include ("$ path"); $ mail = new Mail (); // create a new object $ mail-> IsSMTP ();//? Always use SMTP to send emails $ mail-> SMTPAuth = true ;//? Required for SMTP ?? $ Mail-> SMTPSecure = "ssl"; // SMTP master of Gmail? Need to use SSL ?? $ Mail-> Host = "smtp.gmail.com"; // SMTP master of Gamil? $ Mail-> Port = 465; // SMTP master of Gamil?? Port 465. $ Mail-> CharSet = "UTF-8 ";//? OK? ?? $ Mail-> Username = "onlyfortestlzz@gmail.com ";//? Yes ???? $ Mail-> Password = "abcde ";//? Yes ?? Password? $ Mail-> From = "onlyfortestlzz@gmail.com ";//? Sender's mailbox $ mail-> FromName = "? ";//? Sender name $ mail-> Subject = "PHPMailer ?? Letter ";//? OK? ?? $ Mail-> Body = "Hello ";//? OK?? Rong $ mail-> IsHTML (true );//? OK?? Rong? HTML $ mail-> AddAddress ($ this-> input-> post ('backemail'), $ value-> username );//? Recipient? Parts and name? If (! $ Mail-> Send () {echo 'OK ';}
We recommend that you use pear to install the following three:
(1), Mail
(2), Net_SMTP
(3), Mail_Mime
The mail () function fails because it does not exist.
$ Mail-> Host = "smtp.gmail.com"; // SMTP master of Gamil?
Is it sent from an account.
The email sent by this function is considered as spam by the receiving server. Note: the spam in the mailbox is not very spam. Here, I threw it away.
Php uses phpmailer, and pear is rarely used.
The mail function can only use self-configured SMTP servers without user authentication.
If your SMTP is not approved by the email Alliance, the sent emails will be processed as spam emails.
You can try phpmailer.
$ Path = realpath (dirname (_ FILE __)). '/.. /libraries/Mail. php '; include ("$ path"); $ mail = new Mail (); // create a new object $ mail-> IsSMTP ();//? Always use SMTP to send emails $ mail-> SMTPAuth = true ;//? Required for SMTP ?? $ Mail-> SMTPSecure = "ssl"; // SMTP master of Gmail? Need to use SSL ?? $ Mail-> Host = "smtp.gmail.com"; // SMTP master of Gamil? $ Mail-> Port = 465; // SMTP master of Gamil?? Port 465. $ Mail-> CharSet = "UTF-8 ";//? OK? ?? $ Mail-> Username = "onlyfortestlzz@gmail.com ";//? Yes ???? $ Mail-> Password = "abcde ";//? Yes ?? Password? $ Mail-> From = "onlyfortestlzz@gmail.com ";//? Sender's mailbox $ mail-> FromName = "? ";//? Sender name $ mail-> Subject = "PHPMailer ?? Letter ";//? OK? ?? $ Mail-> Body = "Hello ";//? OK?? Rong $ mail-> IsHTML (true );//? OK?? Rong? HTML $ mail-> AddAddress ($ this-> input-> post ('backemail'), $ value-> username );//? Recipient? Parts and name? If (! $ Mail-> Send () {echo 'OK ';}
Thank you. PHPMAILER has been used.