- 时间:2020-08-26 10:33 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:PHP实现在windows下配置sendmail并通过mail()函数发送邮件的方法
本文实例讲述了PHP实现在windows下配置sendmail并通过mail()函数发送邮件的方法。分享给大家供大家参考,具体如下:
1、php mail()函数在windows不能用,需要安装sendmail。
2、从http://glob.com.au/sendmail/ 下载sendmail组件
3、解压sendmail.zip到目录下,我安装的路径是: F:\root\sendMail
4、配置php.ini,主要配置以下3项
[img]http://files.jb51.net/file_images/article/201706/2017620101014015.png?2017520101257[/img]
5、修改 sendmail.ini,文件路径:F:\root\sendMail\sendmail.ini
smtp_server=smtp.qq.com
smtp_port=25
auth_username=yourusername
auth_password=yourpassword
force_sender=******@qq.com
6、测试发送邮件
<?php
if(mail("test@test.com","测试","测试邮件")){
echo "success";
} else {
echo "fail";
}
更多关于PHP相关内容感兴趣的读者可查看本站专题:《[url=http://www.1sucai.cn/Special/495.htm]PHP网络编程技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/348.htm]PHP基本语法入门教程[/url]》、《[url=http://www.1sucai.cn/Special/623.htm]PHP数组(Array)操作技巧大全[/url]》、《[url=http://www.1sucai.cn/Special/47.htm]php字符串(string)用法总结[/url]》、《[url=http://www.1sucai.cn/Special/357.htm]PHP运算与运算符用法总结[/url]》、《[url=http://www.1sucai.cn/Special/43.htm]php面向对象程序设计入门教程[/url]》、《[url=http://www.1sucai.cn/Special/84.htm]php+mysql数据库操作入门教程[/url]》及《[url=http://www.1sucai.cn/Special/231.htm]php常见数据库操作技巧汇总[/url]》
希望本文所述对大家PHP程序设计有所帮助。