Hi Everyone,
I am testing the basic 'email selected records' on my server. I can not get it to work : it returns an error each time I click the button.
Here's the coding. I have changed a few of the name to fit my Database.
global $dal;
$dal_TableName = $dal->Table("weighbills");
$body="";
foreach(@$keys as $keyblock)
{
$arr=explode("&",refine($keyblock["Weighbill"]));
if(count($arr)<1)
continue;
$arr2=array();
$arr2["Weighbill"]=urldecode(@$arr[0]);
$where = KeyWhere($arr2);
$rstmp = $dal_TableName->Query($where,"");
$datatmp=db_fetch_array($rstmp );
$body .= "Date: " . $datatmp['Date'] . "\n";
$body .= "Branch: " . $datatmp['Branch'] . "\n";
$body .= "Client: " . $datatmp['Client'] . "\n";
$body .= "Route: " . $datatmp['Route'] . "\n";
}
// send the email
$email="xxxxxx@xxxx.xxx";
$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:
";
$result["txt"] = $errmsg;
}