iis下php mail函數(shù)的sendmail配置方法(官方推薦)
更新時(shí)間:2012年04月25日 16:13:36 作者:
很多玩discuz的彭友在使用在線發(fā)郵件的功能,但是測(cè)試了"通過 PHP 函數(shù)的 sendmail 發(fā)送(推薦此方式)"怎么都沒用,因?yàn)楸救爽F(xiàn)在用的是iis+php環(huán)境,所以就出這么一個(gè)教程,教大家在自己服務(wù)器上配置sendmail
首先你需要先到從http://glob.com.au/sendmail/下載sendmail.zip文件,點(diǎn)此可以直接下載噢,然后把它解壓到如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 =
默認(rèn)情況下是以本機(jī)做為郵件服務(wù)器,這里我們需要借用sendmail來發(fā)送郵件,用sendmail來配置如用qq、163的郵箱來發(fā)送(一般都是以這種方式)所以我們需要把所有的選項(xiàng)都注銷,即把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文件,主要填的內(nèi)容有以下幾項(xiàng)
smtp_server=smtp服務(wù)器地址(如 smtp.ym.163.com)
auth_username=郵箱登錄名(如 info@xxxx.com)
auth_password=郵箱密碼(如 xxxxxx)
force_sender=發(fā)件人地址全寫(如 info@xxxx.com)
另外還有一項(xiàng)
; auto = use SSL for port 465, otherwise try to use TLS
把前面的";"刪除,即開啟SSL安全登錄選項(xiàng)即可
以上四項(xiàng)正確填寫修改完成后保存,然后重啟IIS即可正常使用。
如果不能發(fā)送郵件,檢查下端口是不是被屏蔽了,mcafee是不是設(shè)置了禁止發(fā)送郵件等
然后打開php.ini文件,找到下面這段代碼
復(fù)制代碼 代碼如下:
[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 =
默認(rèn)情況下是以本機(jī)做為郵件服務(wù)器,這里我們需要借用sendmail來發(fā)送郵件,用sendmail來配置如用qq、163的郵箱來發(fā)送(一般都是以這種方式)所以我們需要把所有的選項(xiàng)都注銷,即把SMTP = localhost和smtp_port = 25前面加上";"然后把sendmai_path=""前面的";"刪掉,改為sendmai_path="d:\php\sendmail\sendmail.exe -t",改完后的即是
復(fù)制代碼 代碼如下:
[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文件,主要填的內(nèi)容有以下幾項(xiàng)
復(fù)制代碼 代碼如下:
smtp_server=smtp服務(wù)器地址(如 smtp.ym.163.com)
auth_username=郵箱登錄名(如 info@xxxx.com)
auth_password=郵箱密碼(如 xxxxxx)
force_sender=發(fā)件人地址全寫(如 info@xxxx.com)
另外還有一項(xiàng)
復(fù)制代碼 代碼如下:
; auto = use SSL for port 465, otherwise try to use TLS
把前面的";"刪除,即開啟SSL安全登錄選項(xiàng)即可
以上四項(xiàng)正確填寫修改完成后保存,然后重啟IIS即可正常使用。
如果不能發(fā)送郵件,檢查下端口是不是被屏蔽了,mcafee是不是設(shè)置了禁止發(fā)送郵件等
您可能感興趣的文章:
- PHPMailer使用教程(PHPMailer發(fā)送郵件實(shí)例分析)
- PHPMailer郵件類利用smtp.163.com發(fā)送郵件方法
- phpmailer在服務(wù)器上不能正常發(fā)送郵件的解決辦法
- php中mail函數(shù)發(fā)送郵件失敗的解決方法
- phpmail類發(fā)送郵件函數(shù)代碼
- PHP mail 通過Windows的SMTP發(fā)送郵件失敗的解決方案
- phpmailer簡(jiǎn)單發(fā)送郵件的方法(附phpmailer源碼下載)
- thinkphp使用phpmailer發(fā)送郵件的方法
- Ubuntu中啟用php的mail()函數(shù)并解決發(fā)送郵件速度慢問題
- PHP借助phpmailer發(fā)送郵件
- PHP實(shí)現(xiàn)在windows下配置sendmail并通過mail()函數(shù)發(fā)送郵件的方法
相關(guān)文章
php實(shí)現(xiàn)向javascript傳遞數(shù)組的方法
這篇文章主要介紹了php實(shí)現(xiàn)向javascript傳遞數(shù)組的方法,涉及php數(shù)組轉(zhuǎn)json傳遞到j(luò)avascript的實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-07-07使用php數(shù)據(jù)緩存技術(shù)提高執(zhí)行效率
使用php緩存技術(shù)時(shí)為了提高效率。在大量的并發(fā)訪問面前,獲取數(shù)據(jù)可能成為效率的瓶頸,PHP實(shí)際開發(fā)之中針對(duì)數(shù)據(jù)處理進(jìn)行緩存。2022-12-12PHP中的print_r 與 var_dump 輸出數(shù)組
下面小編就為大家?guī)硪黄狿HP中的print_r 與 var_dump 輸出數(shù)組。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考2016-06-06PHP上傳文件時(shí)文件過大$_FILES為空的解決方法
發(fā)現(xiàn)一張gif圖片上傳失敗 size為0,實(shí)際大小為4.66M,下面為大家介紹下PHP上傳文件時(shí)文件過大的解決方法2013-11-11php中使用Imagick實(shí)現(xiàn)圖像直方圖的實(shí)現(xiàn)代碼
玩過單反相機(jī)的人應(yīng)該都知道圖像直方圖(Image Histogram),簡(jiǎn)單點(diǎn)說,它通過計(jì)算每個(gè)色階在總像素中所占的比例來反映圖像的曝光情況。2011-08-08PHP實(shí)現(xiàn)的簡(jiǎn)單sha1加密功能示例
這篇文章主要介紹了PHP實(shí)現(xiàn)的簡(jiǎn)單sha1加密功能,結(jié)合具體實(shí)例形式分析了php sha1加密功能的具體實(shí)現(xiàn)方法與使用技巧,需要的朋友可以參考下2017-08-08PHP面向?qū)ο罄^承用法詳解(優(yōu)化與減少代碼重復(fù))
這篇文章主要介紹了PHP面向?qū)ο罄^承用法,結(jié)合實(shí)例形式分析了php面向?qū)ο蟪绦蛟O(shè)計(jì)中繼承的使用方法及代碼優(yōu)化處理與減少代碼重復(fù)的相關(guān)操作技巧,需要的朋友可以參考下2016-12-12PHP中十六進(jìn)制顏色與RGB顏色值互轉(zhuǎn)的方法
今天小編就為大家分享一篇關(guān)于PHP中十六進(jìn)制顏色與RGB顏色值互轉(zhuǎn)的方法,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧2019-03-03