title: Adding delay in sending each mail using phpmail function, while sending mail to 1000 users in all
body: <p>I want to add a delay of about 30 to 60 seconds between sending of each email to users with phpmail() function. I am taking users email data from table and using while loop and there are about 1000 users in database table. I want there to be a delay in repeating the statement of this while loop, so that every email is sent to next user after that particular user. I am using the the following code:</p>
  
  <pre><code>$sql = "select * from users where `user_email` = '$_REQUEST[q]' or `user_name`='$_REQUEST[q]' ";
  
  $rs_results = mysql_query($sql) or die(mysql_error());   
  
  while ($rrows = mysql_fetch_array($rs_results)) {
  
  $fullname = $rrows['full_name'];
  $usermailid = $rrows['user_email'];
  $username = $rrows['user_name'];
  
  $message =
  "Hello $fullname  \n
  Welcome to My Site \n
  The rest of the message";
  
  mail($usermailid, "Important Message - from Site Admin", $message,
      "From: \"Mysite Admin\" &lt;auto-reply@mysite.com&gt;\r\n" .
       "X-Mailer: PHP/" . phpversion()); 
  }
  </code></pre>
  
  <p>The above code sends all emails together to 1000 users in table in one go. I want that there should be delay of 30 to 60 seconds between sending of each and every email</p>