Current location: Hot Scripts Forums » Programming Languages » PHP » Mailinglist problem...


Mailinglist problem...

Reply
  #1 (permalink)  
Old 09-27-05, 10:27 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Question Mailinglist problem...

I use this loop to pull emails from my DB and send them one by one:
PHP Code:

$mailproblem "";

if (!@
mail($to$subject$message$headers))
{
$mailproblem $front_nonewsmail;
}
/* and to the rest of the users... */
$result $db->sendnewsletter();
   if (!empty(
$result)) {
      while ( list(
$key,$val)=each($result) ) {
      
$useremail stripslashes($val["email"]);
      @
mail($useremail$subject$message$headers);
      }
   }
$successmessage $admin_successmessage;

Is it possible to add a delay between each email being sent in order to reduce serverload?? So that you throttle it to at the very least sending 1 email every 6 seconds or so...
__________________
Today is tomorrow, yesterday...
Reply With Quote
  #2 (permalink)  
Old 09-27-05, 10:29 AM
mousegu mousegu is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
__________________
SSP
Professional Web Design

SSP Website
Reply With Quote
  #3 (permalink)  
Old 09-27-05, 10:55 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mousegu
Thanks!

Added a set_time_limit(3600); to avoid execution time error as well...
__________________
Today is tomorrow, yesterday...
Reply With Quote
  #4 (permalink)  
Old 09-27-05, 10:57 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Add the code between the "///////////////////////" to pause for 6 seconds between mails.
PHP Code:

$mailproblem "";

if (!@
mail($to$subject$message$headers))
{
$mailproblem $front_nonewsmail;
}
/* and to the rest of the users... */
$result $db->sendnewsletter();
   if (!empty(
$result)) {
      while ( list(
$key,$val)=each($result) ) {
     
//////////////////////////////////////////////
     
sleep(6);
     
//////////////////////////////////////////////
      
$useremail stripslashes($val["email"]);
      @
mail($useremail$subject$message$headers);
      }
   }
$successmessage $admin_successmessage;

__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with if statements filth PHP 1 08-04-05 09:18 PM
mailinglist help...need someone with a favour to give? motivesounds Job Offers & Assistance 0 05-23-05 01:54 PM
A Language filter problem, and a problem with a for loop querying my database. . . Spreegem PHP 6 05-08-05 11:03 AM
Count problem kasic ASP.NET 1 10-20-04 12:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM


All times are GMT -5. The time now is 06:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.