2012-10-27 13 views
6

Ho aggiornato il mio server locale utilizzando XAMPP 1.8.0 che contiene Apache 2.4.2, PHP 5.4.5 e MySQL 5.5. Invio mail con la funzione PHP mail() eseguendo MercuryMail, ma nessuna email ricevuta nella mia casella di posta.
L'invio di messaggi di posta elettronica funziona quando ho eseguito il test con Mozilla Thunderbird. E la funzione mail() sembra funzionare senza errori.Nessuna posta ricevuta nella posta in arrivo con XAMPP 1.8.0, MercuryMail e posta()

ho controllato php.ini nel mio XAMPP installazione percorso D: \ xampp \ php. L'ho visto sotto

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

Ho ottimizzato una combinazione di impostazioni SMTP.
ho commentato host e la porta

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

ho commentato sendmail_path, ma non ha funzionato. La posta non può essere inviata.

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

Ancora una volta, ho commentato anothor sendmail_path a lavorare con 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" 

Sembra di lavoro, ma non la posta ricevuto nella posta in arrivo. Non abbiamo trovato nulla in D: \ xampp \ mailoutput

in PHP log di posta (D: \ xampp \ php \ logs \ php_mail.log), ho trovato diverse linee di registro che probabilmente dicendo mail sono state inviando.

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]> 

Ho anche cercato di commentare sendmail_from, ma senza fortuna.

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

Qualche configurazione mi manca ancora?

[Modifica]
Il server di posta Mercury è in esecuzione.
Ogni volta che ho aggiornato php.ini, ho riavviato il server Apache.

risposta

9

Ho solo bisogno di configurare D: \ xampp \ sendmail \ sendmail.ini Per impostazione predefinita, contiene la linea

smtp_server=mail.mydomain.com 

ho dovuto cambiare a

smtp_server=localhost 

Non è necessario configurarlo nelle versioni precedenti di XAMPP.
La configurazione corretta per [mail function] in D: \ xampp \ php \ php.ini è

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

Ora, sto ricevendo mail nella mia casella di posta. Si noti che "D: \ xampp \" è il mio percorso di installazione XAMPP.

+2

Per l'invio di e-mail all'esterno è inoltre necessario disattivare "Non consentire l'inoltro SMTP di posta non locale" nelle impostazioni di Mercury. – Krystian

+0

@ Krystian, Grazie per le tue informazioni. – Sithu

+1

Eccellente, grazie per questo. – Magicode

0

Assicurarsi che il server di mercury mail sia in esecuzione, non eseguito di default.

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"