php mail()
Posted cyany_blue
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php mail()相关的知识,希望对你有一定的参考价值。
First:
open the php.ini
and find the keyword mail function
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
SMTP = smtp.163.com
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from ="[email protected]"
;sendmail_from="[email protected]";
$to = "[email protected]";
$subject = "this is a subject";
$message = "haha ,this is a letter .";
$header = "From:[email protected]";
$retval = mail($to,$subject,$message,$header);
if($retval){
echo "successful";
}else{
echo "fail";
}
Reference:
https://stackoverflow.com/questions/5335273/how-to-send-an-email-using-php
Note:
mail() will not work in local server.
ozzz
以上是关于php mail()的主要内容,如果未能解决你的问题,请参考以下文章