【发布时间】:2011-07-20 23:21:24
【问题描述】:
所以,我下载并安装了 smtp4dev。
当我尝试在我的 php 文件中发送邮件时:
mail('localhost', "Hey there", "no");
我从 php.ini 收到一个错误,抱怨 sendmail_from 没有声明。
我尝试声明它:
sendmail_from = postmaster@localhost
这使 php 保持沉默,但仍然无法正常工作 - 尝试加载页面 30 秒,然后出现另一个错误。致命错误:超过 30 秒的最大执行时间。
我必须如何配置 php.ini 才能让它工作?
php.ini
[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 = postmaster@localhost
; 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"
; 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 =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"
【问题讨论】: