php
  • email
  • 2016-05-10 5 views 1 likes 
    1

    の下で受信されることはありません、私はPHPに新しいですし、私は確認のメールを送信しようとしています:PHPのメールがGmailの

    public static function sendAuthenticationEmail($username, $email, $uuid) { 
        $subject = "Register email address"; 
        $headers = 'MIME-Version: 1.0' . PHP_EOL . 
           'Content-type: text/html; charset=iso-8859-1' . PHP_EOL . 
           'To: ' . $username . ' <' . $email . '>' . PHP_EOL . 
           'From: whereisthemonkey <[email protected]>' . PHP_EOL . 
           'X-Mailer: PHP/' . phpversion(); 
        $link = 'http://localhost/Whereisthemonkey/FileSystem/EmailSystem.php?email=' . 
          $email . '&uuid=' . substr($uuid, 0, 14); 
        $message = ' 
         <html> 
          <head> 
           <title>Email authentication</title> 
          </head> 
          <body style="color: #000080"> 
           <p style="font-weight: bold; color: #990000">Do not reply to the email!</p> 
           <p>Hey ' . $username . ', this email has recently been used as authentication on <b>Whereisthemonkey</b>!<br><br> 
           If that was you, please click 
           <a href="' . $link . '">here</a><br><br> 
           <p>If that was not you, please just ignore this email!</p> 
           <p>Have a nice day, the whereisthemonkey team! 
          </body>'; 
        return mail($email, $subject, $message, $headers); 
    } 
    

    メールが送信されますが、(この場合のGmailで)サーバに到着したことはありません。

    私は間違っていますか?

    ありがとう、 ルーカス!

    +1

    偶然Googleアカウントの迷惑メールフォルダを調べていませんか? – heximal

    +0

    PHPMailerのようなsmtpライブラリを使用してください。あなたが認証されていない場合、多くのメールサーバはスパムのため配信を拒否します。 –

    +0

    @heximalはい、それは迷惑メールフォルダにありません –

    答えて

    2

    GmailがあなたのサーバーのIPアドレスをブラックリストに登録しているか、メールがあなたの迷惑メールフォルダに移動している可能性があります。

    別のサーバーに同じコードを入力するか、SMTP接続を使用してください。

    +0

    いいえ、他のサーバーは動作しません。 –

    関連する問題