2012-10-27 57 views
6

我使用包含Apache 2.4.2,PHP 5.4.5和MySQL 5.5的XAMPP 1.8.0升級了本地服務器。 我通過運行MercuryMail發送帶有PHP郵件()函數的郵件,但沒有在收件箱中收到郵件。
當我使用Mozilla Thunderbird進行測試時發送郵件正在工作。而mail()函數似乎正在工作,沒有發佈錯誤。我的XAMPP安裝路徑D:\ xampp \ php。我在下面看到這個在XAMPP 1.8.0,MercuryMail和郵件收件箱中收到郵件()

[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 = [email protected] 

; 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 \日誌\ php_mail.log),我發現這很可能說是郵件發送一些日誌行。

mail() on [D:\xampp\htdocs\....:127]: To: [email protected] -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=text/html Return-Path:Sithu <[email protected]> From: Sithu <[email protected]> Reply-To: Sithu <[email protected]> 
mail() on [D:\xampp\htdocs\....:127]: To: [email protected] -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=text/html Return-Path:[email protected] From: [email protected] Reply-To: [email protected] 
mail() on [D:\xampp\htdocs\....:127]: To: [email protected] -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=text/html Return-Path:Members <[email protected]> From: Members <[email protected]> Reply-To: Members <[email protected]> 

我也試着註釋掉sendmail_from,但沒有運氣。

; For Win32 only. 
; http://php.net/sendmail-from 
sendmail_from = [email protected] 

任何配置我仍然失蹤?

[編輯]
Mercury郵件服務器正在運行。
每當我更新php.ini,我重新啓動Apache服務器。

回答

9

我只需要配置d:\ XAMPP \ sendmail的\ sendmail.ini 默認情況下,它包含

smtp_server=mail.mydomain.com 

我不得不將其更改爲

smtp_server=localhost 

不需要在舊版本的XAMPP中進行配置。
正確的配置[mail function]D:\ xampp \ php \ php。ini is

; 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安裝路徑。

+2

要在外部發送電子郵件,還需要在Mercury設置中禁用「不允許SMTP中繼非本地郵件」。 – Krystian

+0

@Krystian,謝謝你的信息。 – Sithu

+1

優秀,贊成這個。 – Magicode

0

確保汞郵件服務器正在運行,默認情況下它不運行。

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= [email protected] 
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 = [email protected] 

    ; 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"