dsilhx5830 2014-04-30 20:42
浏览 42

如何处理phpmailer中的每小时邮件限制

I am using PHP mailer, which is working fine, apart from i think the host is limited to 100 per hour. below is the debug message issued after 100 have been sent.

SERVER -> CLIENT: 550 enquiries@**.me exceeded rate limit ( 100.2 / 1h ) 2014-04-30 19:01:30 SMTP ERROR: DATA command failed: 550 enquiries@**.me exceeded rate limit ( 100.2 / 1h ) SMTP Error: data not accepted. SMTP Error: data not accepted.

i need to send out approx 1600 emails (around once every 2 weeks), but can not find out how to do this with the limit in place.

Any advice on how to do this, without the need to go back and run the script manually every hour until all emails are sent.

Hope this is the right place to post this question, only i have googled and can not find any simple answers (other than contact the host....)

In case there is a script way out of this, below is the code i am using

if($result = $user_obj->getAllNewsletterWhereActive($db)){
        try {
            // initiate object for mail and set smtp
            $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
            $mail->IsSMTP(); // telling the class to use SMTP           
            $mail->SMTPKeepAlive = true;// keep the SMTP open (remember to close at end of script)


            $mail->Host       = "mail.******.me"; // SMTP server
            $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
            $mail->SMTPAuth   = true;                  // enable SMTP authentication
            $mail->Host       = "mail.******.me"; // sets the SMTP server
            $mail->Port       = 587;                    // set the SMTP port for the GMAIL server
            $mail->Username   = "enquiries@*******.me"; // SMTP account username
            $mail->Password   = "*******";        // SMTP account password
            $mail->AddReplyTo('enquiries@******.me');
            $mail->SetFrom('enquiries@******.me');
            $mail->AddReplyTo('enquiries@******.me');
            $mail->Subject = $Subject;
            $mail->isHTML(true);  



            foreach($result as $row) {
                // build simple unsubscribe link
                $resetCode = base64_encode($row->NewsletterEmail);
                $websiteLink = 'http://'.$_SERVER['HTTP_HOST'].'/unsubscribe.php?code='.$resetCode;

                $mail->Timeout    =   60; // set the timeout (seconds)
                $mail->Body = $Message.'<br><br>Please click the below link to unsubscribe <br><a href="'.$websiteLink.'">Unsubscribe</a>'; // 
                $mail->AddAddress($row->NewsletterEmail);

                // send email and output success or fail massage
                if($mail->Send()){
                    $message .= 'Message Sent OK to '.$row->NewsletterEmail.'<br>';
                }
                else {
                    $error .= 'Message FAILED to '.$row->NewsletterEmail.'<br>';
                }

                // clear the address for the next loop
                $mail->clearAddresses();                
            }

            // close SMTP conncetion
            $mail->SmtpClose();

        } 
        catch (phpmailerException $e) {         
            echo $e->errorMessage(); //Pretty error messages from PHPMailer         
        } 
        catch (Exception $e) {          
            echo $e->getMessage(); //Boring error messages from anything else!          
        }

    }
    else {
        $error .= '<strong>Error! </strong>There was no email addresses returned or selected. please try again or contact support!<br>';
    }

Any advice greatly appreciated!

  • 写回答

2条回答 默认 最新

  • duanao3204 2014-04-30 21:27
    关注

    Not sure if this will help you but it solved the same problem for me a few months ago http://m.youtube.com/watch?v=tlqmbNtW_x8

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大