I need to send a email to all the registered users in the Login table based on the fact that they want to receive e-mails:
This code seems to work.
global $dal;
$tblUsers = $dal->Table("Login");
$rs = $tblUsers->Query("SendAvailable='Yes'","");
while ($data = db_fetch_array($rs))
{
$email=$data["Email"].", ";
$from="admin@test.com";
$msg="Check testing mails";
$subject="December";
foreach($values as $field=>$value)
{
if(!IsBinaryType(GetFieldType($field)))
$msg.= $field." : ".$value."\r\n";
}
$ret=runner_mail(array('to' => $email, 'subject' => $subject,'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"]."
";
}
return true;
I, however need this mail only to go out if the value of the AddDate field in the JobsAvailable table is equal to today's date.
Something like this:
$dalTableName = $dal->Table("JobsAvailable");
$rs = $dalTableName->Query("DateDiff(now(),AddDate)>0","");;
Ps. I'm not sure what the value (varchar, date, etc)of the AddDate field should be
I don't know how to "combine" these two queries so that the result will be sending a mail to
Sending email of todays added record
to All users in the login table
That marked there Sendavailable as Yes.
Anyone that can assist I'll appreciate.
I would want to place this in a php file to use as a Cronjob to send this e-mails every day. Help on achieving this would be great!