2012-10-27 69 views
6

Tôi đã nâng cấp máy chủ cục bộ của mình bằng XAMPP 1.8.0 chứa Apache 2.4.2, PHP 5.4.5 và MySQL 5.5. Tôi gửi thư bằng hàm PHP mail() bằng cách chạy MercuryMail, nhưng không nhận được email nào trong hộp thư đến của tôi.
Gửi thư đang hoạt động khi tôi thử nghiệm với Mozilla Thunderbird. Và hàm mail() dường như đang hoạt động mà không có lỗi nào được đưa ra.Không có thư nào nhận được trong hộp thư đến với XAMPP 1.8.0, MercuryMail và thư()

Tôi đã kiểm tra php.ini trong đường dẫn cài đặt XAMPP của tôi D: \ xampp \ php. Tôi đã thấy điều này bên dưới

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

Tôi đã điều chỉnh một số kết hợp cài đặt SMTP.
Tôi nhận xét ra host và cổng

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

Tôi nhận xét ra sendmail_path, nhưng nó đã không làm việc. Không thể gửi thư.

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

lần nữa, tôi nhận xét ra anothor sendmail_path để làm việc với 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" 

Nó dường như làm việc, nhưng không có thư nhận được trong hộp thư đến. Không tìm thấy gì trong số D: \ xampp \ mailoutput

Trong nhật ký thư php (D: \ xampp \ php \ logs \ php_mail.log), tôi tìm thấy một số dòng đăng nhập có khả năng là thư đang gửi.

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

Tôi cũng đã cố gắng để nhận xét ra sendmail_from, nhưng không có may mắn.

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

Mọi cấu hình tôi vẫn bị thiếu?

[Chỉnh sửa]
Máy chủ thư thủy ngân đang chạy.
Bất cứ khi nào tôi cập nhật php.ini, tôi đã khởi động lại máy chủ Apache.

Trả lời

9

Tôi chỉ cần phải cấu hình D: \ xampp \ sendmail \ sendmail.ini Theo mặc định, nó có chứa các dòng

smtp_server=mail.mydomain.com 

tôi đã phải thay đổi nó để

smtp_server=localhost 

Không cần phải định cấu hình điều này trong các phiên bản cũ của XAMPP.
Cấu hình chính xác cho [mail function] trong 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" 

Hiện tại, tôi đang nhận thư trong hộp thư đến của mình. Xin lưu ý rằng "D: \ xampp \" là đường dẫn cài đặt XAMPP của tôi.

+2

Để gửi email bên ngoài, bạn cũng cần phải hủy kích hoạt "Không cho phép chuyển tiếp SMTP thư không phải cục bộ" trong cài đặt Mercury. – Krystian

+0

@Krystian, Cảm ơn bạn đã thông tin. – Sithu

+1

Tuyệt vời, thaks cho việc này. – Magicode

0

Đảm bảo rằng máy chủ thư thủy ngân đang chạy, nó không chạy theo mặc định.

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" 
Các vấn đề liên quan