PHP function sends some mail, not others

Whatsitmean

New Member
I have this function:\[code\]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;}\[/code\]Being called like this:\[code\]//send instructions $f_error['failure'] = sendEmail ($email, "1", ADMIN, $link); $f_error['failure'] = sendEmail (ADMIN, "2");\[/code\]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?
 
Back
Top