Note that there are some explanatory texts on larger screens.

plurals
  1. POThrottling PHPmailer for use in Elgg
    primarykey
    data
    text
    <p>I'll be using the social networking software, Elgg, for an organization that needs to send mass emails to specific groups when they need to. The number of emails can range from 10-1000 depending on the group. Web host only allows 500 emails per hour, so I need to throttle the script to send one email every 8 seconds.</p> <p>I'm using PHPmailer with Elgg. PHPmailer says that I should use these two scripts (code below) in conjunction with each other in order to throttle the mailing. I know how I'm going to use the code in the mailing script, I'm just unsure about a couple things.</p> <p>1) I don't really understand the purpose for the safemode</p> <p>2) After looking up set_time_limit, it looks like I should set this to an amount of time to allow all potential emails to be sent, whether it's 10 or 1000? Or is this a max of 30 seconds per loop in case it needs to timeout?</p> <p>3) How should I set this to get what I need?</p> <p>Links to PHPmailer describing code:</p> <p><a href="http://phpmailer.worxware.com/index.php?pg=tip_ext" rel="nofollow">http://phpmailer.worxware.com/index.php?pg=tip_ext</a></p> <p><a href="http://phpmailer.worxware.com/index.php?pg=tip_pause" rel="nofollow">http://phpmailer.worxware.com/index.php?pg=tip_pause</a></p> <pre><code> &lt;?php /* The following code snippet with set the maximum execution time * of your script to 300 seconds (5 minutes) * Note: set_time_limit() does not work with safe_mode enabled */ $safeMode = ( @ini_get("safe_mode") == 'On' || @ini_get("safe_mode") === 1 ) ? TRUE : FALSE; if ( $safeMode === FALSE ) { set_time_limit(300); // Sets maximum execution time to 5 minutes (300 seconds) // ini_set("max_execution_time", "300"); // this does the same as "set_time_limit(300)" } echo "max_execution_time " . ini_get('max_execution_time') . "&lt;br&gt;"; /* if you are using a loop to execute your mailing list (example: from a database), * put the command in the loop */ while (1==1) { set_time_limit(30); // sets (or resets) maximum execution time to 30 seconds) // .... put code to process in here if (1!=1) { break; } } ?&gt; </code></pre> <p>and </p> <pre><code>&lt;?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; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload