OK
Now for the second part.
I am using this function to get and send the mail.
function emailMembers($membersArray)
{
if (count($membersArray) > 0)
{
foreach ($membersArray as $member)
{
$to = $member["user_email"];
$subject = __("blah blah");
$cancel_message .= __("blah blah")."\r\n\n";
mail($to,$subject,$cancel_message);
}
}
}
Mail_Queue calls for a second file which is called add_message.php shown below.
<?php
include './config.php';
/* we use the db_options and mail_options here */
$mail_queue =& new Mail_Queue($db_options, $mail_options);
$from = 'user@server.com';
$to = "user2@server.com";
$message = 'Hi! This is test message!! :)';
$hdrs = array( 'From' => $from,
'To' => $to,
'Subject' => "test message body" );
/* we use Mail_mime() to construct a valid mail */
$mime =& new Mail_mime();
$mime->setTXTBody($message);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
/* Put message to queue */
$mail_queue->put( $from, $to, $hdrs, $body );
?>
Can I make the add_message.php code part of my emailMembers function (the first one above)? And then call it when the condition is met? Does that work? And then run a cron job to process the emails?
If not what would your suggestion be?
Thanks again for helping me.