立即注冊 找回密碼

QQ登錄

只需一步,快速開始

PHP 在windows下配置sendmail,通過 mail() 函數(shù)發(fā)送郵件

2015-3-1 23:49| 發(fā)布者: 學習NO.1| 查看: 538| 評論: 0|原作者: 學習NO.1

摘要: php mail()函數(shù)在windows不能用,需要安裝sendmail。1. 從http://glob.com.au下載sendmail.zip2. 解壓sendmail.zip到目錄下(最好使用短路徑,長路徑會導致問題的出現(xiàn)),我安裝的路徑是: E:\wamp\sendmail3.修改php.i ...

php mail()函數(shù)在windows不能用,需要安裝sendmail。

1. 從http://glob.com.au下載sendmail.zip

2. 解壓sendmail.zip到目錄下(最好使用短路徑,長路徑會導致問題的出現(xiàn)),我安裝的路徑是: E:\wamp\sendmail

3.修改php.ini 配置,我是使用的QQ郵箱發(fā)送郵件。配置如下圖所示:


001.jpg

4.修改 sendmail.ini,文件路徑:E:\wamp\sendmail\sendmail.ini

  1. smtp_server=smtp.qq.com
  2. smtp_port=25
  3. auth_username=yourusername
  4. auth_password=yourpassword
  5. force_sender=*****@qq.com
復制代碼

下面這兩項最好開啟,方便查看那里出問題了

  1. ; log smtp errors to error.log (defaults to same directory as sendmail.exe)
  2. ; uncomment to enable logging

  3. error_logfile=error.log

  4. ; create debug log as debug.log (defaults to same directory as sendmail.exe)
  5. ; uncomment to enable debugging

  6. debug_logfile=debug.log
復制代碼

5.測試發(fā)送郵件功能

  1. <?php
  2. header("Content-type:text/html;charset=utf-8");

  3. if(mail("test@test.com","測試","測試郵件")){
  4.     echo "發(fā)送成功!!";
  5. }else{
  6.     echo "發(fā)送失。!";
  7. }

  8. ?>
復制代碼

>> 本文固定鏈接: http://www.phpmarker.com/1.html

>> 轉(zhuǎn)載請注明: phpmarker 2014年01月03日 于 phpmarker.com 發(fā)表



鮮花

握手

雷人

路過

雞蛋

最新評論

相關推薦
!jz_fbzt! !jz_lxwm! !jz_gfqqq!

關于我們|手機版|小黑屋|地圖|【道勤網(wǎng)】-bmrsportswear.com 軟件視頻自學教程|免費教程|自學電腦|3D教程|平面教程|影視動畫教程|辦公教程|機械設計教程|網(wǎng)站設計教程【道勤網(wǎng)】 ( 皖ICP備15000319號-1 )

GMT+8, 2024-10-24 02:00

Powered by DaoQin! X3.4 © 2016-2063 Dao Qin & 道勤科技

返回頂部