收件箱中没有收到XAMPP 1.8.0,MercuryMail和mail()的邮件

Sit*_*thu 6 php email xampp smtp sendmail.exe

我使用XAMPP 1.8.0升级了本地服务器,其中包含Apache 2.4.2,PHP 5.4.5和MySQL 5.5.我通过运行MercuryMail发送带有PHP mail()函数的邮件,但我的收件箱中没有收到任何电子邮件.
当我使用Mozilla Thunderbird进行测试时,发送邮件正在工作.并且mail()函数似乎没有发出错误.

我在我的XAMPP安装路径D:\ xampp\php中检查了php.ini.我在下面看到了这个

[mail function]  
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury  
; SMTP = localhost  
; smtp_port = 25  

; For Win32 only.  
; http://php.net/sendmail-from  
; sendmail_from = postmaster@localhost  

; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesD:\xampp) fakemail and mailtodisk do not work correctly.  
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.    

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)  
; sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"  

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the D:\xampp\mailoutput folder  
; sendmail_path = "D:\xampp\mailtodisk\mailtodisk.exe"  
Run Code Online (Sandbox Code Playgroud)

我调整了一些SMTP设置的组合.
我评论了主机和端口

; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury  
SMTP = localhost  
smtp_port = 25
Run Code Online (Sandbox Code Playgroud)

我注释掉了sendmail_path,但它没有用.邮件无法发送.

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)  
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"  
Run Code Online (Sandbox Code Playgroud)

再次,我评论了anothor sendmail_path以使用mailToDisk

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the D:\xampp\mailoutput folder  
sendmail_path = "D:\xampp\mailtodisk\mailtodisk.exe"  
Run Code Online (Sandbox Code Playgroud)

它似乎有效,但收件箱中没有收到邮件.在D:\ xampp\mailoutput中找不到任何内容

在php邮件日志(D:\ xampp\php\logs\php_mail.log)中,我发现了几条可能说邮件正在发送的日志行.

mail() on [D:\xampp\htdocs\....:127]: To: sithu@localhost.com -- Headers: MIME-Version: 1.0  Content-type: text/html; charset=text/html  Return-Path:Sithu <stk@localhost.com>  From: Sithu <stk@localhost.com>  Reply-To: Sithu <stk@localhost.com>  
mail() on [D:\xampp\htdocs\....:127]: To: test@localhost.com -- Headers: MIME-Version: 1.0  Content-type: text/html; charset=text/html  Return-Path:admin@localhost.com  From: admin@localhost.com  Reply-To: admin@localhost.com  
mail() on [D:\xampp\htdocs\....:127]: To: test@localhost.com -- Headers: MIME-Version: 1.0  Content-type: text/html; charset=text/html  Return-Path:Members <admin@localhost.com>  From: Members <admin@localhost.com>  Reply-To: Members <admin@localhost.com> 
Run Code Online (Sandbox Code Playgroud)

我也试图评论sendmail_from,但没有运气.

; For Win32 only.  
; http://php.net/sendmail-from  
sendmail_from = postmaster@localhost  
Run Code Online (Sandbox Code Playgroud)

我仍然缺少任何配置?

[编辑]
Mercury邮件服务器正在运行.
每当我更新php.ini,我重新启动Apache服务器.

Sit*_*thu 9

我只需要配置D:\ xampp\sendmail\sendmail.ini 默认情况下,它包含该行

smtp_server=mail.mydomain.com
Run Code Online (Sandbox Code Playgroud)

我不得不改变它

smtp_server=localhost
Run Code Online (Sandbox Code Playgroud)

无需在旧版本的XAMPP中进行配置.在D:\ xampp\php\php.ini中
的正确配置 是[mail function]

; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = 127.0.0.1
smtp_port = 25

; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesD:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.  

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the D:\xampp\mailoutput folder
; sendmail_path = "D:\xampp\mailtodisk\mailtodisk.exe"
Run Code Online (Sandbox Code Playgroud)

现在,我收到了收件箱中的邮件.请注意"D:\ xampp \"是我的XAMPP安装路径.

  • 要在外部发送电子邮件,还需要在Mercury设置中停用"不允许SMTP中继非本地邮件". (2认同)