Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first
php mail()函數(shù)在windows不能用,需要安裝sendmail
1.從http://glob.com.au/sendmail/下載sendmail.zip
2.解壓到C:下,例如C:\php\sendmail,最好短路徑,長路徑名有可能產(chǎn)生問題。
3.修改php.ini如下
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
4.根據(jù)你自己的配置環(huán)境修改sendmail.ini。
第一次最好啟用debug.log_file,error_logfile,以查看sendmail是否生效。
5.重啟apache
用sendmail結(jié)合其它的smtp服務(wù)器,如smtp.163.com來實現(xiàn)發(fā)郵件?,F(xiàn)在大部分郵箱都要求smtp驗證,所以要在sendmail.ini中加入用戶名和密碼。
php.ini配置 (以用163郵箱為例)
[mail function]
; For Win32 only.
SMTP = smtp.163.com
smtp_port = 25
; For Win32 ……
用sendmail結(jié)合其它的smtp服務(wù)器,如smtp.163.com來實現(xiàn)發(fā)郵件。現(xiàn)在大部分郵箱都要求smtp驗證,所以要在sendmail.ini中加入用戶名和密碼。
php.ini配置 (以用163郵箱為例)
[mail function]
; For Win32 only.
SMTP = smtp.163.com
smtp_port = 25
; For Win32 only.
sendmail_from = 4u4v@163.com
; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = “D:\xampp\sendmail\sendmail.exe -t”
就配置三項,smtp、smtp_port和sendmail_path
sendmail.ini配置
[sendmail]
; you must change mail.mydomain.com to your smtp server
smtp_server=smtp.163.com
smtp_port=25
auth_username=yourusername
auth_password=yourpassword
force_sender=yourusername@163.com
sendmail網(wǎng)上有下的,如果你是用xampp,那里面直接就帶了。
同時在虛擬主機(jī)的conf里加上這樣一句
php_admin_value sendmail_path ‘D:\xampp\sendmail\sendmail.exe -t 4u4v@163.com’
此郵件地址為用戶的郵件地址,隨便添。