title: mail() in foreach loop
body: <p>mail() is used to send email to users in the array provided to foreach loop. I want to put limit to the number of emails sent per hour. Besides, I need to keep track of how many emails sent and not sent ( with AJAX possibly ). </p>
  
  <p>Is there I can put pause between the time each email is sent, other than sleep()? Coz it stops the whole script and I will not be able to track the number of emails being sent.</p>
  
  <p>Code is simple:</p>
  
  <pre><code>foreach ($user_emails as $user_email) {
      if(mail( $user_email, $subject, $model-&gt;message, $headers))
      {
          echo "sent &lt;/br&gt;";
  
      }
  } 
  </code></pre>
  
  <p>Advice on good library would also be great! Thanks :)</p>