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 圖像處理與SESSION制作超簡(jiǎn)單驗(yàn)證碼的方法示例
這篇文章主要介紹了PHP 圖像處理與SESSION制作超簡(jiǎn)單驗(yàn)證碼的方法,結(jié)合實(shí)例形式詳細(xì)分析了PHP結(jié)合session繪制圖形驗(yàn)證碼相關(guān)操作技巧,需要的朋友可以參考下2019-12-12
PHP實(shí)現(xiàn)負(fù)載均衡session共享redis緩存操作示例
這篇文章主要介紹了PHP實(shí)現(xiàn)負(fù)載均衡session共享redis緩存操作,涉及php用戶登陸、session存儲(chǔ)、判斷等相關(guān)操作技巧,需要的朋友可以參考下2018-08-08

