vbnullchar Posted November 21, 2006 Share Posted November 21, 2006 why is it im receiving 3 emails eveytime i run this script? is there something wrong with the codes?[code] $employee = new cEmployee(); $employee_details = $employee->getDetails($empid); $strQuery = "SELECT email, sup_id, raw_name FROM employees WHERE id='".$employee_details['sup_id']."'"; $result = $mysql->query($strQuery); $row = $mysql->fetch_array($result); $mysql->free_result($result); $to = $employee_details['email']; $subject = 'Email'; $message = 'email content'; $message = wordwrap($message,70); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "To: $employee_details[raw_name] <$employee_details[email]>\r\n"; $headers .= "From: Emailer \r\n"; $headers .= "Cc: $employee_details[email] \r\n"; if(!mail($to, $subject, $message, $headers)){ die('error sending mail'); }[/code] Quote Link to comment Share on other sites More sharing options...
btherl Posted November 21, 2006 Share Posted November 21, 2006 Maybe it's because you specify the email as the first argument of mail(), in the To: header and also in the Cc: header. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.