|
global $dal;
$dal_TableName = $dal->Table("TableName");
$body="";
foreach(@$keys as $keyblock)
{
$arr=explode("&",refine($keyblock["FieldName"]));
if(count($arr)<1)
continue;
$arr2=array();
$arr2["FieldName"]=urldecode(@$arr[0]);
$where = KeyWhere($arr2);
$rstmp = $dal_TableName->Query($where,"");
$datatmp=db_fetch_array($rstmp );
$body .= "OrderID: " . $datatmp['OrderID'] . "\n";
$body .= "Customer: " . $datatmp['CustomerID'] . "\n";
$body .= "Employee: " . $datatmp['EmployeeID'] . "\n-----------\n\n";
}
// send the email
$email="test@test.com";
$subject="Sample subject";
$arr = runner_mail(array('to' => $email, 'subject' => $subject,
'body' => $body));
$result["txt"] = "Emails were sent.";
// if error happened print a message on the web
page
if (!$arr["mailed"])
{
$errmsg = "Error happened: <br>";
$errmsg.= "File: " . $arr["errors"][0]["file"] . "<br>";
$errmsg.= "Line: " . $arr["errors"][0]["line"] . "<br>";
$errmsg.= "Description: " . $arr["errors"][0]["description"] . "<br>";
$result["txt"] = $errmsg;
}
|