首页 > Web开发 > 详细

php mail()

时间:2018-11-24 15:34:17      阅读:189      评论:0      收藏:0      [点我收藏+]

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()

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!