Hello, I used that code for daily expired jobs mails and its awesome. However,
I need it to mail to person who is responsible of the job.
So in the "TableName" table i have a field called "resposible_id" and that ID is the ID of user in "UserTable" table.
Also "UserTable" has "email" field.
I need it to email to that person?
How can i do it?
Thanks alot!
<?php
include("include/dbcommon.php");
global $dal;
$dalTableName = $dal->Table("TableName");
$rstmp = $dalTableName->Query("DateDiff(now(),ExpiryDate)>0","");;
while ($datatmp = db_fetch_array($rstmp))
{
//send email for each record
$email="blabla@test.com";
//EmailField is your actual field name
$msg="This event was expired\r\n";
$msg.="FieldName1: ".$datatmp["FieldName1"]."\r\n";
$msg.="FieldName2: ".$datatmp["FieldName2"]."\r\n";
$subject="Expired";
runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg));
}
//FieldName1, FieldName2 and ExpiryDate are your actual field names, TableName is your actual table name
?>