Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2009
    Posts
    156
    Thanks
    47
    Thanked 0 Times in 0 Posts

    Need help understanding "sleep" in Mailing List app

    I'm using a Mailing List application I use for a small subscriber base has the following settings in the config file:

    $cfg['pauseinterval'] = 100;

    $cfg['pausetime'] = 3;

    In the page that sends the email, here is the supporting code:

    PHP Code:
    if (!isset($err)) {
              
    // WE'RE READY TO SEND!!!
              
    $cnt 0;
              while (
    $item readitem($f)) {
                
    // pause if we're on a multiple of the pause interval
                
    if ($cfg['pauseinterval'] > && $cnt%(int)$cfg['pauseinterval'] == && $cnt != 0) {
                  
    sleep((int)$cfg['pausetime']);
                }
                
    // fetch addresses and send
                
    if (@mail($item['addr'], $subj$body$headers)) $succ++;
                else 
    $fail++;
                
    $cnt++;
                
    // update the temp file with resume info
                
    if ($cfg['enableresume'] && $cfg['savemail']) {
                  
    rewind($fr);
                  
    fwrite($fr$item['id']."\r\n");
                }
              }
            }
            if (
    $cfg['enableresume'] && $cfg['savemail']) {
              
    // mailing is done, so we delete the temp file
              // or, if this is a resume, delete the old temp file
              
    fclose($fr);
              if (
    $_POST['resume']) {
                
    unlink($cfg['savemailto'].'/'.'tmp_'.substr($_POST['resume'],4));
              }
              else {
                
    unlink($cfg['savemailto'].'/tmp_'.$mfile.'.txt');
              }
            }
          }
        } 
    Can someone explain how these two settings work and perhaps the considerations based on the number of recipients?

  • #2
    Regular Coder kokjj87's Avatar
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    279
    Thanks
    1
    Thanked 55 Times in 54 Posts
    I think that the main reason is to give the server enough time to rest/unload...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •