2010-12-03 2 views
0

こんにちは、私は私のメールを配信するためにPHPのメール機能を使用しています。私はこの警告を受ける正確な理由を知らないPHPのメール機能を使用して一度に200人以上のメンバーにメールを送ることができません

$sqlquery1 = "select employee from empl where sstatus != 'C'"; 
$sqlmath1 = mysql_query($sqlquery1) or die("Error: (" . mysql_errno() . ") " . mysql_error()); 
    $cnt = mysql_num_rows($sqlmath1); 
    if($cnt !="0") { 
    while($query1 = mysql_fetch_array($sqlmath1)) 
    { 
    $email1=$query1['employee']; 
    $emid1=base64_encode($email1); 
    $sid1 =base64_encode($sidtest); 
    $email_from1 = "[email protected]"; 
    $link1="http://www.xx.php?mid=$emid1&sid=$sid1"; 
    //send mail 
    $emailto_web1  = $email1; 
    $email_headers1 = "From: ".$email_from1; 
    num_sent_web1 = 0; 
    $email_message21 = "Dear Employee, \n"; 
    $email_message21 .= "\n"; 
    $email_message21 .= "If you cannot click on the URL, copy the URL and paste it on your address bar.\n"; 
    $email_message21 .= "\n"; 
    $email_message21 .= $link1."\n"; 
    $email_message21 .= "\n\n\n"; 
    $email_message21 .= "Regards,\n"; 
    $email_message21 .= "Admin Team. \n"; 

    $mail_web1 = mail($emailto_web1,$email_subject1,$email_message21,$email_headers1); 
    if($mail_web1) 
     { $err = "Remainder Send Successfully"; 
       } 
       else 
        { $err=$email." Try Again"; 
         } 
     } 
     } // not equal to zero condition 

:私は400以上の電子メールIDと同じコードを実行した場合、それは私がこのコードを使用しています

Warning: mail() [function.mail]: Could not execute mail delivery program '/usr/sbin/sendmail -t -i' in /home/sendInvite.php on line 147 

警告メッセージのリンクを表示しますメッセージ、貴重な提案を投稿してください。前もって感謝します !!!

答えて

3

これにはcronジョブを使用し、一度にすべてのメールを送信するのではなく、チャンクでメールを送信します。

0

phpのメール機能のマニュアルを参照してください。

それはメール()関数は、ループ内で電子メールの大量に適していないことは注目に値します。この関数は、電子メールごとにSMTPソケットを開閉しますが、効率的ではありません。 大量の電子メールを送信するには、»PEAR :: Mail、および»PEAR :: Mail_Queueパッケージを参照してください。

さらに、serverlist:https://serverfault.com/questions/67154/sending-an-email-to-about-10k-users-not-spamの関連する質問を参照してください。そしてここに - https://serverfault.com/questions/68357/whats-the-best-way-to-send-bulk-email,https://stackoverflow.com/questions/1543153/is-there-a-limit-when-using-php-mail-function

0

私はあなたのスクリプトに問題はないと思うが、あなたのオペレーティングシステムやメールプログラムのインストールに問題があるとは思えない。すべての可能性を試してください。PHP側からは大丈夫です。

0

あなたの最善の選択肢は、cronジョブを使用することです。このようにすると、サーバーに大きなストレスがかかります。 mail()関数は大量の電子メール用ではありません。大量のサーバーを使用すると、サーバーの処理速度が低下します。

Thisは、サーバーでcronジョブを作成する方法を説明します。

希望すると助かります!