2013-03-18 20 views
0

我不能讓PHP郵件發送電子郵件...apache,mercury32,php郵件。不能得到它的工作

所有這一切只是爲了測試我的PHP郵件功能在我的本地主機設置。 XAMPP-apache,mercury,mysql,windowXP

我很確定我安裝了水銀32正確的,如果我用它發送郵件到[email protected]它工作正常,我看到它發送並在我的雷鳥收件箱我爲它設立了。

的php.ini是我變得有點困惑

[mail function] 
;---- I left this as is(out), since I AM using Mercury 
; 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] 
;---- I created a root user in mercury 
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 
;---- I left this as is(in), but I feel it should be commented out, but if I take out i get error in pho mail() code 
sendmail_path = "D:\xampp\mailtodisk\mailtodisk.exe" 

PHP代碼的郵件();

..... 
    $mailSubject = "Hello there!!!"; 
    $mailFrom  = "From: [email protected]" . "\r\n"; 
    $mailTo  = "[email protected]"; 

    if (mail($mailTo, $mailSubject, $mailMessage, $mailFrom)){ 
     echo("Message successfully sent! $mailTo"); 
    } 
    else { 
     echo("Message delivery failed..."); 
    } 

郵件被髮送,但到哪裏?我永遠無法找到它

一些圖像: 測試汞。又到「文件>發送郵件」得到這個屏幕並創建了一個電子郵件,以測試上述圖像的 testing Mercury. Went to "file>Send mail message" to get this screen and created an email to test

客戶端的電子郵件收件箱 - 結果/測試 client email inbox- result of the above image/test

在瀏覽器腳本輸出 screen output

+0

您的郵件功能從這樣的眼光來看是正確的。是否正在打印交付失敗錯誤?也許你還有其他錯誤。沒有其他的想法 – Davit 2013-03-18 00:28:31

+0

汞是最有可能保持原木,檢查出來;應該給你更多的見解。 – castis 2013-03-18 00:31:47

+0

在MERCURYS.LOG中沒有任何意義 – rudy 2013-03-18 00:43:04

回答

0

(第一,因爲我的英文不好對不起) 要solutionate此,我配置php.ini並sendmail.ini這樣的:

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

; 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:\xampp\sendmail\sendmail.exe\" -t" 
;sendmail_path = "C:\xampp\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" 

而且sendmail.ini

[sendmail] 

; you must change mail.mydomain.com to your smtp server, 
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup) 
; emails delivered via IIS's pickup directory cause sendmail to 
; run quicker, but you won't get error messages back to the calling 
; application. 

;smtp_server=mail.mydomain.com 

smtp_server=localhost 

記得評論的sendmail_path上的php.ini 現在是爲我工作:)