本文實例講述了PHP實現(xiàn)在windows下配置sendmail并通過mail()函數(shù)發(fā)送郵件的方法。分享給大家供大家參考,具體如下:
1、php mail()函數(shù)在windows不能用,需要安裝sendmail。
2、從http://glob.com.au/sendmail/ 下載sendmail組件
3、解壓sendmail.zip到目錄下,我安裝的路徑是: F:rootsendMail
4、配置php.ini,主要配置以下3項
5、修改 sendmail.ini,文件路徑:F:rootsendMailsendmail.ini
smtp_server=smtp.qq.com smtp_port=25 auth_username=yourusername auth_password=yourpassword force_sender=******@qq.com
6、測試發(fā)送郵件
<?php if(mail("test@test.com","測試","測試郵件")){ echo "success"; } else { echo "fail"; }
更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《PHP網(wǎng)絡(luò)編程技巧總結(jié)》、《PHP基本語法入門教程》、《PHP數(shù)組(Array)操作技巧大全》、《php字符串(string)用法總結(jié)》、《PHP運算與運算符用法總結(jié)》、《php面向?qū)ο蟪绦蛟O(shè)計入門教程》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》
希望本文所述對大家PHP程序設(shè)計有所幫助。