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

时间:2012-10-27 13:38:41

标签: php email smtp xampp 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"  

我调整了一些SMTP设置组合 我注释掉了主机和端口

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

我注释掉 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"  

同样,我评论了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"  

看起来很有效,但收件箱中没有邮件收到。在 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> 

我还试图评论 sendmail_from ,但没有运气。

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

我还缺少任何配置?

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

3 个答案:

答案 0 :(得分:9)

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

smtp_server=mail.mydomain.com

我不得不将其改为

smtp_server=localhost

无需在旧版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"

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

答案 1 :(得分:0)

确保水银邮件服务器正在运行,默认情况下不会运行。

答案 2 :(得分:0)

#GMAIL mit XAMPP 1.8.1 und sendmail
[CODE]
[sendmail]
; HOTMAIL
smtp_server=smtp.gmail.com
smtp_port=25
smtp_ssl=tls
tls_certcheck off
error_logfile=error.log
debug_logfile=debug.log
auth_username= xxxx.xxxx@gmail.com
auth_password=xxxxxxx


 this settings in php.ini   
 [mail function]
    ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
    ; SMTP = smtp.gmail.com
    ; smtp_port = 25

    ; For Win32 only.
    ; http://php.net/sendmail-from
    sendmail_from = xxxx.xxxx@gmail.com

    ; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\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 = "\"C:\sendmail\sendmail.exe\" -t"

    ; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
    ;sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe"

    ; 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\php\logs\php_mail.log"