百度後才知道 mail()函數在windows系統中 不能直接使用,
需要下載sendmail,http://glob.com.au/sendmail
下載後解壓下,路徑自定義一下,最好別太長,例如:E:\sendmail
然後在php.ini配置文件中加入以下配置(以163郵箱爲例)
[mail function]
SMTP = smtp.163.com
smtp_port = 25
sendmail_from = [email protected]
sendmail_path = "E:\sendmail\sendmail.exe -t"
然後修改sendmail.ini文件(是修改不是添加)
smtp_server=smtp.163.com //這裏是配置對應的163的smtp
smtp_port=25
auth_username=username //郵箱用戶名
auth_password=password //郵箱密碼
[email protected] //你的郵箱全名 用戶名@163.com
注發送郵件一般只用到smtp協議,至於收郵件的pop3協議就不需要了,一般項目只需要發郵件