2016-07-08 6 views
0

私はxammpを使用していませんが、 "fake sendmail for windows"を使用しています。 "sendmail.ini"GAMILメールサーバを使用してPHPでXAMMPを実行せずにlocalhostから電子メールを送信

'[Modify] the php.ini file to use it (commented out the other lines): 

'[mail function] 
'; For Win32 only. 
'; SMTP = smtp.gmail.com 
'; smtp_port = 25 

'; For Win32 only. 
'; sendmail_from = <e-mail username>@gmail.com 

'; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). 
'sendmail_path = "C:\xampp\sendmail\sendmail.exe -t" 

とphp.iniの

[sendmail] 

smtp_server=smtp.gmail.com 
smtp_port=25 
error_logfile=error.log 
debug_logfile=debug.log 
auth_username=<username> 
auth_password=<password> 
force_sender=<e-mail username>@gmail.com' 

それでも反対このエラーにI

'Warning: mail(): SMTP server response: 421-4.7.0 [14.200.59.18 15] Our  system has detected that this message is 421-4.7.0 suspicious due to the very low reputation of the sending IP address. 421-4.7.0 To protect our users from spam, mail sent from your IP address has 421-4.7.0 been temporarily rate limited. Please visit 421 4.7.0 https://support.google.com/mail/answer/188131 for more information. c185si2211020itg.117 - gsmtp in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\introducingphp\Code Work php\testmail.php on line 10 
Check your email now....' 

私testmailため、この設定のため、この設定で

.phpコード:

<?php 
ini_set("SMTP", "aspmx.l.google.com"); 
ini_set("sendmail_from", "[email protected]"); 

$message = "The mail message was sent with the following mail  setting:\r\nSMTP = aspmx.l.google.com\r\nsmtp_port = 25\r\nsendmail_from = [email protected]"; 

$headers = "From:[email protected]"; 


mail("[email protected]", "Testing", $message, $headers); 
echo "Check your email now....<BR/>"; 
?> 
+0

これはどこにホストされていますか?あなたのパーソナルデスクトップ、またはホスティングプロバイダ?ホスティングプロバイダの場合、GoogleのIPアドレスが低い評価を受けていると考えられる問題かもしれません。それがあなたのパーソナルコンピュータなら、これはあなたが対処しなければならないことかもしれません。あなたはよく知られているホスティングプロバイダではありません。Googleは人々があなたと同じことをするのを阻止しようとしています。ループ。 – Jake

+0

この投稿にも質問がありますか? –

+0

@Jakeそれは個人的なデスクトップです。 – Mily

答えて

0

これは、電子メールが送信しやすいという不幸な副作用です。誰でもコードを書いて電子メールを送信することができます。あなたの意図は最も純粋ですが、コードをループで実行しないようにするにはどうすればいいですか?@ gmail.comで終わる文字と数字の組み合わせに何千ものメッセージを送信しますか?

スパムフィルタです。エラーメッセージhttps://support.google.com/mail/answer/188131によって提供されたリンクに基づいて、あなたのサーバー(実際にはデスクトップだけで、私は個人的なインターネット接続を想定しています)がガイドライン(https://support.google.com/mail/answer/81126?hl=en)を満たしているとはGoogleでは考えていません。あなたは静的IPのようなものをあなたの家に設定して、IPアドレスの評判を上げたり、Googleのガイドラインに従わせたりすることができます...しかし、Webホスティング会社のサーバーを使ってコードを実行する方がずっと簡単でしょう。

もう1つの方法は、ウェブホストに既にドメイン名が設定されている場合は、Gmailにメールを送信しないことです。そうすれば、メッセージを確実に受け取ることができます。

関連する問題