FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » time consuming loop
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: time consuming loop [message #170891 is a reply to message #170886] Sun, 05 December 2010 17:59 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
Paul Fredlein wrote:
> Hi,
>
> I never thought of Bcc, but I have around 300 to email.
>
Ask your ISP.

Mine said up to 250 or 250 an hour, 'but we can make an exception for
your IP address' or something. I have no more than 100 at the moment


here's my code - adjusted for anonymity
$employee _id contains the identity of the person using the mailer -
they are uses as the return and fro addresses.

$_POST['status'] selects a subset of the entire mailing list.

function sendmail()
{
global $employee_id;
if(isset($_POST['status']))
$status=$_POST['status'];
else return("-1");
if (strlen($_POST['body'])<1)
return ("-2");
else $body=stripslashes($_POST['body']);
$subject=$_POST['subject'];
$return_path="webmaster(at)mysite(dot)org";
$from=mysql_result(mysql_query(sprintf("select email
from people
where id='%d'",
$employee_id)),0,'email');
// get list of addressees
mysql_query("set group_concat_max_len = 8192");
//...to avoid truncation
// This bit gets a comma delimited array of email
// addresses disregarding those that have no '@' in them
$email=mysql_result(mysql_query(sprintf("select 1 as g,
group_concat(email separator ',') as them
from people
where status>='%d' and instr(email,'@')
group by g",$status)),
0,'them');
//
$headers = sprintf("From: %s\nBcc:%s\n", $from,$email);
mail('', $subject, $body, $headers, "-f ".$return_path );
return("");
}


That may serve as a starting point for you.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Demo PHP/Ajax slideshow server crashing
Next Topic: Apache + PHP module segfaults
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 16:15:54 GMT 2024

Total time taken to generate the page: 0.04206 seconds