Hello
I have this function:
function sendEmail ($to, $id, $from='n', $link='n') {
//retrieve message from system
$where = "id = '".$id."'";
$resource = dbSelect (TMAIL, $where);
if ($resource[0] !== 1) {
return "Error sending email";
}
$subject = $resource[1]['subject'];
$body = $resource[1]['body'];
//create and send email
if ($link !== "n") {
$body = $body.' <a href="'.$link.'">'.$link.'</a>';
}
if ($from == 'n') {
$from = ADMIN;
}
mail ($to, $subject, $body, $from);
//deubug
//print_r($resource);
//echo $from;
//echo $to;
//echo $subject;
//echo $body;
//echo $link;
}
Being called like this:
//send instructions
$f_error['failure'] = sendEmail ($email, "1", ADMIN, $link);
$f_error['failure'] = sendEmail (ADMIN, "2");
In the above case the first call to sendEmail doesn't appear to do anything and the second being sent twice. I've checked the variables/constants being sent to the function and the code itself and can find nothing to explain this behavior.
Can anyone suggest what could be preventing this from working?