iis下php mail函數(shù)的sendmail配置方法(官方推薦)
更新時間:2012年04月25日 16:13:36 作者:
很多玩discuz的彭友在使用在線發(fā)郵件的功能,但是測試了"通過 PHP 函數(shù)的 sendmail 發(fā)送(推薦此方式)"怎么都沒用,因為本人現(xiàn)在用的是iis+php環(huán)境,所以就出這么一個教程,教大家在自己服務器上配置sendmail
首先你需要先到從http://glob.com.au/sendmail/下載sendmail.zip文件,點此可以直接下載噢,然后把它解壓到如D:\php\sendmail\目錄下。
然后打開php.ini文件,找到下面這段代碼
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; sendmail_path = ""
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
默認情況下是以本機做為郵件服務器,這里我們需要借用sendmail來發(fā)送郵件,用sendmail來配置如用qq、163的郵箱來發(fā)送(一般都是以這種方式)所以我們需要把所有的選項都注銷,即把SMTP = localhost和smtp_port = 25前面加上";"然后把sendmai_path=""前面的";"刪掉,改為sendmai_path="d:\php\sendmail\sendmail.exe -t",改完后的即是
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "d:\php\sendmail\sendmail.exe -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
注意以上只需要開啟sendmail_path即可,然后保存
接著修改sendmail目錄下的sendmail.ini文件,主要填的內容有以下幾項
smtp_server=smtp服務器地址(如 smtp.ym.163.com)
auth_username=郵箱登錄名(如 info@xxxx.com)
auth_password=郵箱密碼(如 xxxxxx)
force_sender=發(fā)件人地址全寫(如 info@xxxx.com)
另外還有一項
; auto = use SSL for port 465, otherwise try to use TLS
把前面的";"刪除,即開啟SSL安全登錄選項即可
以上四項正確填寫修改完成后保存,然后重啟IIS即可正常使用。
如果不能發(fā)送郵件,檢查下端口是不是被屏蔽了,mcafee是不是設置了禁止發(fā)送郵件等
然后打開php.ini文件,找到下面這段代碼
復制代碼 代碼如下:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; sendmail_path = ""
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
默認情況下是以本機做為郵件服務器,這里我們需要借用sendmail來發(fā)送郵件,用sendmail來配置如用qq、163的郵箱來發(fā)送(一般都是以這種方式)所以我們需要把所有的選項都注銷,即把SMTP = localhost和smtp_port = 25前面加上";"然后把sendmai_path=""前面的";"刪掉,改為sendmai_path="d:\php\sendmail\sendmail.exe -t",改完后的即是
復制代碼 代碼如下:
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "d:\php\sendmail\sendmail.exe -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
注意以上只需要開啟sendmail_path即可,然后保存
接著修改sendmail目錄下的sendmail.ini文件,主要填的內容有以下幾項
復制代碼 代碼如下:
smtp_server=smtp服務器地址(如 smtp.ym.163.com)
auth_username=郵箱登錄名(如 info@xxxx.com)
auth_password=郵箱密碼(如 xxxxxx)
force_sender=發(fā)件人地址全寫(如 info@xxxx.com)
另外還有一項
復制代碼 代碼如下:
; auto = use SSL for port 465, otherwise try to use TLS
把前面的";"刪除,即開啟SSL安全登錄選項即可
以上四項正確填寫修改完成后保存,然后重啟IIS即可正常使用。
如果不能發(fā)送郵件,檢查下端口是不是被屏蔽了,mcafee是不是設置了禁止發(fā)送郵件等
您可能感興趣的文章:
- PHPMailer使用教程(PHPMailer發(fā)送郵件實例分析)
- PHPMailer郵件類利用smtp.163.com發(fā)送郵件方法
- phpmailer在服務器上不能正常發(fā)送郵件的解決辦法
- php中mail函數(shù)發(fā)送郵件失敗的解決方法
- phpmail類發(fā)送郵件函數(shù)代碼
- PHP mail 通過Windows的SMTP發(fā)送郵件失敗的解決方案
- phpmailer簡單發(fā)送郵件的方法(附phpmailer源碼下載)
- thinkphp使用phpmailer發(fā)送郵件的方法
- Ubuntu中啟用php的mail()函數(shù)并解決發(fā)送郵件速度慢問題
- PHP借助phpmailer發(fā)送郵件
- PHP實現(xiàn)在windows下配置sendmail并通過mail()函數(shù)發(fā)送郵件的方法
相關文章
php實現(xiàn)向javascript傳遞數(shù)組的方法
這篇文章主要介紹了php實現(xiàn)向javascript傳遞數(shù)組的方法,涉及php數(shù)組轉json傳遞到javascript的實現(xiàn)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-07-07使用php數(shù)據(jù)緩存技術提高執(zhí)行效率
使用php緩存技術時為了提高效率。在大量的并發(fā)訪問面前,獲取數(shù)據(jù)可能成為效率的瓶頸,PHP實際開發(fā)之中針對數(shù)據(jù)處理進行緩存。2022-12-12PHP中的print_r 與 var_dump 輸出數(shù)組
下面小編就為大家?guī)硪黄狿HP中的print_r 與 var_dump 輸出數(shù)組。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考2016-06-06php中使用Imagick實現(xiàn)圖像直方圖的實現(xiàn)代碼
玩過單反相機的人應該都知道圖像直方圖(Image Histogram),簡單點說,它通過計算每個色階在總像素中所占的比例來反映圖像的曝光情況。2011-08-08