Hello everyone, I recently learned about PHP. I want to ask you a question about sending an email using PHP. I use Windows. Php. [mail & nbsp; function]; & nbsp; For & nbsp; Win32 & nbsp; only. SMTP & nbsp; = & nbs questions about [PHP Mail]
Hello everyone, I recently learned PHP by myself. I have a question about using PHP to send emails.
I use Windows.
Php. ini is set as follows:
[Mail function]
; For Win32 only.
SMTP = smtp.163.com
Smtp_port = 25
; For Win32 only.
Sendmail_from = red_song@163.com
The script for sending the email is:
$ Msg = "OK? \ N ";
$ Recipient = "57295374@qq.com ";
$ Subject = "Form Submission Results ";
$ Mailheaders = "From: My Web Site \ n ";
$ Mailheaders. = "Reply-To:". $ _ POST ["email"];
Mail ($ recipient, $ subject, $ msg, $ mailheaders );
However, emails cannot be sent all the time. please help me solve the problem. Is there anything wrong with smtp?
------ Solution --------------------
The mail function can only be used on sender servers without user authentication.
While smtp.163.com requires user authentication, that is, after logging on
You can use the phpmailer tool class to send emails.
------ Solution --------------------
Reference:
How can I use the mail function provided by php?
You must configure service parameters in apache httd. conf.