php - 如何配置 php.ini 以与 smtp4dev 一起使用?

标签 php email smtp

所以,我下载并安装了 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/

相关文章:

c# - 邮件消息的“收件人”、“抄送”、“密件抄送”允许为 null (system.net.mail.mailmessage)

email - 使用 Web API 与 SMTP API 的 SendGrid 模板

java - Spring 集成 : SMTP server

php - 在 PHP 中获取 POST 数据

php - 如何插入主键第二表

php - 在 Laravel 5 中的预加载中应用Where子句

php - 使用 if else 显示赞助商,不显示 PHP

Java获取未读邮件

email - 为什么我每天都会收到 DMARC 报告?

c# - 发送 "on behalf of"电子邮件