0

PHPメールでメールを送信できません...

これはすべて、ローカルホストの設定でphpメール機能をテストするためだけのものです。XAMPP-apache、mercury、mysql、windowXP

私はmercury32を正しくインストールしたと確信しています。これを使用して、root @ localhost.comに電子メールを送信すると、正常に動作します。送信されたことがわかり、thunderbirdの受信トレイで設定しました。

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 = postmaster@localhost
;---- I created a root user in mercury
sendmail_from = root@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
;---- 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"

mail();のPHPコード

   .....
   $mailSubject   = "Hello there!!!";
   $mailFrom      = "From: me123@gamil.com" . "\r\n";
   $mailTo        = "root@localhost.com";

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

メールは送信されますが、どこに送信されますか?私はそれを見つけることができません

いくつかの画像: Mercuryのテスト。「ファイル>メールメッセージの送信」に移動してこの画面を表示し、テスト用のメールを作成しました マーキュリーのテスト。 行った

クライアントの電子メール受信ボックス-上記の画像/テストの結果 クライアントの電子メール受信ボックス-上記の画像/テストの結果

ブラウザでのスクリプト出力 画面出力

4

1 に答える 1

0

(最初: 下手な英語で申し訳ありません) これを解決するために、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 = postmaster@localhost

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

PHP.ini の sendmail_path にコメントすることを忘れないでください。

于 2013-08-15T05:56:21.490 に答える