码迷,mamicode.com
首页 > Web开发 > 详细

php mail()

时间:2018-11-24 15:42:48      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:http   ali   code   head   val   local   mes   end   work   

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 ="admin@wampserver.invalid"
;sendmail_from="xxx@163.com";
$to = "xxx@qq.com";
$subject = "this is a subject";
$message = "haha ,this is a letter .";
$header = "From:xxx@163.com";
$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()

标签:http   ali   code   head   val   local   mes   end   work   

原文地址:https://www.cnblogs.com/cyany/p/10012227.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!