webdev007
Programmer
- Sep 9, 2005
- 168
This mailer (Bottom script) is CRON activated and as is, it does fine.
but I would like sending the emails in bacthes and pausing in between each batch
if this was procedural I could use
<<<<<<<
<?
$between_delay = 10; $send_delay = 30;
for ( $sent=0; $row = mysql_fetch_array($result); $sent++ )
{
if ( ($sent % $between_delay) == 0 )
sleep( $send_delay );
$emailall = $row[0];
>>>>>>>
But cannot figure how adapting it in an OOP environment using mysql_fetch_object.
any idea on doing it?
Thanks
$mailer = new CcMailer();
$sql = mysql_query("
SELECT
p.first_name, p.email, p.type, p.state, p.id,
m.subject, m.htmlbody, m.textbody,
l.time_posted, l.state_lost, l.hook, l.id
FROM
(a bunch of join tables)....
"); //echo"sql $sql";
while($row = mysql_fetch_object($sql))
{
// Send the emails in this loop.
$member_name = $row->first_name;
$address=$row->email;
but I would like sending the emails in bacthes and pausing in between each batch
if this was procedural I could use
<<<<<<<
<?
$between_delay = 10; $send_delay = 30;
for ( $sent=0; $row = mysql_fetch_array($result); $sent++ )
{
if ( ($sent % $between_delay) == 0 )
sleep( $send_delay );
$emailall = $row[0];
>>>>>>>
But cannot figure how adapting it in an OOP environment using mysql_fetch_object.
any idea on doing it?
Thanks
$mailer = new CcMailer();
$sql = mysql_query("
SELECT
p.first_name, p.email, p.type, p.state, p.id,
m.subject, m.htmlbody, m.textbody,
l.time_posted, l.state_lost, l.hook, l.id
FROM
(a bunch of join tables)....
"); //echo"sql $sql";
while($row = mysql_fetch_object($sql))
{
// Send the emails in this loop.
$member_name = $row->first_name;
$address=$row->email;