» PHPMailer for PHP4
» PHPMailer for PHP5/6
» PHPMailer-FE (Form2Email)
» PHPMailer-ML
» PHPMailer-BMH

Pausing Your Script Execution

Your web server may have some limits on how many emails you can send in a given period of time. Our server, for example, limits emails sent by any web account to 60 emails in 60 seconds. Most scripts can run a lot faster than that - which means that your script will fail to send most of its emails if your mailing lists exceeds 60 email addresses ... and if you read the Extending Execution Time tip, you will immediately note the problem with this statement. If your script and processor can handle it, your script will crash in thirty seconds anyhow ... and have processed a maximum of 60 emails. If your mailing list exceeds 60 email addresses, you will have to use a combination of the Extending Execution Time tip, along with this one:


<?php

/* Note: set_time_limit() does not work with safe_mode enabled */

while (1==1) {
  set_time_limit(30); // sets (or resets) maximum  execution time to 30 seconds)
  // .... put code to process in here

  usleep(1000000); // sleep for 1 million micro seconds - will not work with Windows servers / PHP4
  // sleep(1); // sleep for 1 seconds (use with Windows servers / PHP4
  if (1!=1) {
    break;
  }
}

?>
    


[ Return to TIPS page ]

Design by WorxStudio.com Copyright © 1999-2009, Worx International Inc. All Rights Reserved. Privacy Policy