XAMPP附帶了一個 「假」 sendmail程序。如果您使用的XAMPP,您可以使用sendmail像這樣:(忽略「僅適用於UNIX」的警告,它工作正常的Windows)
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
; http://php.net/smtp-port
;smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "C:/xampp/sendmail/sendmail.exe -t -i"
的Sendmail應該有它sendmail.ini
;應該是這樣配置:
# Example for a user configuration file
# Set default values for all following accounts.
defaults
logfile "C:\xampp\sendmail\sendmail.log"
# Mercury
#account Mercury
#host localhost
#from [email protected]
#auth off
# A freemail service example
account ACCOUNTNAME_HERE
tls on
tls_certcheck off
host smtp.gmail.com
from EMAIL_HERE
auth on
user EMAIL_HERE
password PASSWORD_HERE
# Set a default account
account default : ACCOUNTNAME_HERE
當然,用任意帳戶名稱替換ACCOUNTNAME_HERE,一個有效的電子郵件(如Gmail或Hotmail等)代替EMAIL_HERE,並與密碼到您的電子郵件取代PASSWORD_HERE。現在,你應該可以發送郵件。請記住重新啓動Apache(從控制面板或批處理文件)以允許對PHP進行更改。
所以看起來我用wamp做了一個糟糕的選擇。 – vla 2010-09-09 12:17:23
@vla沒什麼大不了的,加水星應該相當容易。單獨安裝它,並在php.ini中指定'localhost'作爲SMTP服務器應該完成這項工作。 – 2010-09-09 12:18:33