title: sending emails partitioned phpmailer
body: <p>I had time on another post to respond on time, sorry.</p>
  
  <p>The purpose of the process is that after a definite time mails are sent to users of a website.</p>
  
  <p>I have a cron that executes a php file at a specific time</p>
  
  <p>For example, every Monday at 8:00 a.m.</p>
  
  <pre><code>* 8 ** 1 php-f / $ filepath ()
  </code></pre>
  
  <p>This php file sends thousands of emails but instead of sending all continuously from 8am, I want send 30 mails per minute from 8:00 eg</p>
  
  <p>That is:</p>
  
  <p>08:00 -> 0-30 mails</p>
  
  <p>08:01 -> 30-60 mails</p>
  
  <p>08:02 -> 60-90 mails ... etc.</p>
  
  <p>Since launching the cron runs once at 8am I thought about using php sleep function to pause between minutes but does not Respect the command, the system fails and is locked. In my experiences with C the sleep function always work correctly.</p>
  
  <p>I set the shipping to send 30 mails when and exit the loop with a counter</p>
  
  <pre><code> ***** php-f /$filepath ()
  </code></pre>
  
  <p>and so force the system to run the file every minute.</p>
  
  <p>My code</p>
  
  <pre><code>    $res = $admin-&gt;array_mixed(); //Array with all mails address
  
      $send_per_min=30;
      $send = 0;
  
      foreach ($res as $r){
      $mails-&gt;AddAddress("$r['invitacion_email']");
      .
      .
      .
      $mails = new PHPMailer(true);
  $mails-&gt;Mailer = "smtp";
      .
      .
      .
      if($mails-&gt;Send()){                                      
      $send++;
      $log_OK .= $mail." Send!!! \n";
      }else{                              
      $log_KO .= $mail." Failed!!! \n";
      }
  
  
      if ($send == $send_per_min){//With this line I checked that after making 30 shipments out of the loop until the next minute the cron rerun
      //I want to replace it with a sleep that once sent 30 mails, wait until the next minute. In this way, you could set the cron at a specific time
      break;
      }
  
      }//End for
  </code></pre>
  
  <p>I hope you have been more clear than in the previous post (<a href="https://stackoverflow.com/questions/15393432/sending-emails-with-phpmailer-partitioned">https://stackoverflow.com/questions/15393432/sending-emails-with-phpmailer-partitioned</a>).</p>
  
  <p>Greetings to the community.</p>
  
  <p>Pd-Sorry for my bad English</p>