6

Apache 2.4.2、PHP 5.4.5、および MySQL 5.5 を含む XAMPP 1.8.0 を使用してローカル サーバーをアップグレードしました。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"  

繰り返しますが、別の 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 サーバーを再起動しました。

4

3 に答える 3

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 インストール パスであることに注意してください。

于 2012-12-19T14:56:43.810 に答える
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"
于 2012-11-05T05:57:20.080 に答える
0

Mercury メール サーバーが実行されていることを確認します。デフォルトでは実行されません。

于 2012-10-27T13:42:30.727 に答える