XAMPP应该附带一个“假”的发送邮件程序。在这种情况下,您也可以使用 sendmail:
[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 = me@example.com
; 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 postmaster@localhost
#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替换为任意帐户名,将EMAIL_HERE替换为有效的电子邮件(例如Gmail或Hotmail),并将PASSWORD_HERE替换为电子邮件的密码。现在,您应该能够发送邮件。请记住重新启动Apache(从控制面板或批处理文件)以允许对PHP的更改生效。