所以,我下载并安装了 smtp4dev。
当我尝试在我的 php 文件中发送邮件时:
mail('localhost', "Hey there", "no");
我从 php.ini 收到错误,提示未声明 sendmail_from。
我尝试声明它:
sendmail_from = postmaster@localhost
这使得 php 静默,但仍然不起作用 - 尝试加载页面 30 秒,然后另一个错误。 fatal error :超出了 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"
最佳答案
smtp4dev 的作者在这里: 抱歉,这可能是以下错误: http://smtp4dev.codeplex.com/workitem/6080
您的 php.ini 看起来正确。使用 CodePlex 的最新版本重试一次,应该没问题。
关于php - 如何配置 php.ini 以与 smtp4dev 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6769678/