0

件名のように..!

次のようにファイルを構成しました

php.iniで

  SMTP =smtp.gmail.com
  smtp_port = 587
  sendmail_from = my adress@gmail.com
  sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

そしてsendmail.iniで

    smtp_server=smtp.gmail.com
    smtp_port=587
    smtp_ssl=tls
    auth_username=(my adress @gmail.com)
    auth_password=( here my gamil account password )

明確にするために、ここで私のphpコードを見ることができます!

      $headers = "MIME-Version: 1.0" . "\r\n";
      $headers .= "Content-type: text/html; charset=iso-8859-1"."\r\n";
      $headers .="From: my adress @gmail.com"."\r\n";

       $subject = "Your New Password";
       $message = "Your new password is as follows:
        ----------------------------
        Password: $emailpassword
         ----------------------------
        Please make note this information has been encrypted into our database 

        This email was automatically generated."; 



      if(!mail($forgotpassword, $subject, $message, $headers)){
         die ("Sending Email Failed, Please Contact Site Admin! ($site_email)");
      }else{
           print'New Password Sent!.';
     } 

送信時に受け取るのは New Password Sent! です。

本当に送信されたかのようにエラーはありませんが、メールを確認するとメッセージがありません!!

注:私はwindows-7で実行しています

ありがとうございました。

4

1 に答える 1

0

ローカルでは、gmail SMTP サーバーへの接続が許可されていません。独自のインターネット プロバイダーの SMTP サーバーにのみアクセスできます。ただし、このような単純な SMTP サーバーをローカルにインストールすることもできます。

一部のネットワークでは、これにより xampp からローカルにインストールされた SMTP サーバーにメールをローカルに送信し、そこからインターネットに送信できます。

于 2012-07-25T09:44:27.367 に答える