php email

Hi
I have a website that has stopped sending all emails it is just sending customer emails it should send an email to restaurant. below is the script is there something missing. any help would be great.

<?php $order = getSqlRow(" SELECT o.*, u.email FROM orders o INNER JOIN users u ON o.userid = u.id WHERE o.id = " . $res_id ); $order_detail_results = mysql_query(" SELECT od.*, p.name FROM order_details od INNER JOIN products p ON od.prodid = p.id WHERE orderid = " . $res_id ); $need_address = getWhere("order_types","need_address","order_type='".safe($order['order_type'])."'"); $msgpaypal = ''; $total_amount = 0; $order_details = ''; if ($order['paymenttype']=="PayPal") { $msgpaypal="IMPORTANT NOTE : Please check your PayPal email for payment status!
"; } if ($order['paymenttype']=="PayFast") { $msgpaypal="IMPORTANT NOTE : Please check your PayFast email for payment status!
"; } if ($order['paymenttype']=="Google Checkout") { $msgpaypal="IMPORTANT NOTE : Please check your google merchant account for payment status!
"; } while ($row = mysql_fetch_array($order_detail_results)) { $order_details .= "- ". $row['qty'] ." x ". $row['name'] . ' ['. setPrice($row['price']) . "]
"; $order_details .= $row['optionals']; $total_amount += $row['subtotal']; } //email to restaurant if (SITE_EMAIL) { $sender=SITE_EMAIL; $to = getVal("rests","email",$order['resid']); $reply=SITE_EMAIL; $subject="New Order"; $msg="
Hello,

You recieved a new order.
Order ID : #".$res_id."
-----------------------------------------------------
Order Type :
".$order['order_type']."
-----------------------------------------------------
Order Details :
".$order_details; if ($order['order_note']) { $msg .= "-----------------------------------------------------
Comments/Requirements :
" . nl2br($order['order_note']) . '
'; } $msg .= "-----------------------------------------------------
Contact Name :
".$order['name']."
-----------------------------------------------------
Contact Phone :
".$order['phone']."
-----------------------------------------------------
GSM :
".$order['mobilphone']."
-----------------------------------------------------
"; if ($need_address==1) { $msg.="Delivery Address :
".nl2br($order['address'])."
". $order['postcode'] . "
-----------------------------------------------------
"; } $msg.="Payment Type :
".$order['paymenttype']."
".$msgpaypal." -----------------------------------------------------
Order total : ".setPrice($total_amount)."

For details please goto your admin order page.

Regards
"; $mailheaders= "Content-Type: text/html; charset=utf-8" . "\n"; $mailheaders.="Return-path: $sender <$sender>\n"; $mailheaders.="From: <$sender>\n"; $mailheaders.="Reply-To: ".$sender."\n"; $mailheaders.="X-Mailer: php/" . phpversion()."\n"; $mailheaders.="X-Return-Path: $sender\n"; //@mail($to,$subject. " [$orderId]",$msg,$mailheaders); send_email(SITE_EMAIL,$subject. " [$res_id]",$msg,$mailheaders); send_email($to,$subject. " [$res_id]",$msg,$mailheaders); send_email($to,$subject. " [$res_id]",$msg,$mailheaders); // Send twice for printing } //custemer email $custemer_email = $order['email']; if (strlen($custemer_email)>5) { $msg_custemer="
".$GLOBALS['hello'].",

".$GLOBALS['email_your_order_details']."
".$GLOBALS['email_order_id']." : #".$res_id."
--------------------------------------------------------------------------
".$GLOBALS['order_type']." :
".$order['order_type']."
--------------------------------------------------------------------------
".$GLOBALS['email_order_details']." :
".$order_details; if ($order['order_note']) { $msg_custemer .= "--------------------------------------------------------------------------
Comments/Requirements :
" . nl2br($order['order_note']) . '
'; } $msg_custemer .= "--------------------------------------------------------------------------
".$GLOBALS['email_contact_phone']." :
".$order['phone']."
--------------------------------------------------------------------------
".$GLOBALS['email_mobilphone']." :
".$order['mobilphone']."
--------------------------------------------------------------------------
"; if ($need_address==1) { $msg_custemer.="".$GLOBALS['email_delivery_address']." :
" .nl2br($order['address'])."
". $order['postcode'] . "
--------------------------------------------------------------------------
"; } $msg_custemer.="".$GLOBALS['email_payment_type']." :
".$order['paymenttype']."
--------------------------------------------------------------------------
".$GLOBALS['email_order_total']." : ".setPrice($total_amount)."

".$GLOBALS['email_best_regards']."
".SITEURL."
"; $mailheaders= "Content-Type: text/html; charset=utf-8" . "\n"; $mailheaders.="Return-path: $sender <$sender>\n"; $mailheaders.="From: <$sender>\n"; $mailheaders.="Reply-To: ".$sender."\n"; $mailheaders.="X-Mailer: php/" . phpversion()."\n"; $mailheaders.="X-Return-Path: $sender\n"; //@mail($custemer_email,"Order # [$orderId]",$msg_custemer,$mailheaders); send_email($custemer_email,$GLOBALS['email_order']." # [$res_id]",$msg_custemer,$mailheaders); }

Have you checked to make sure the SITE_EMAIL is the value you are expecting?

Sponsor our Newsletter | Privacy Policy | Terms of Service