Hi
I have a website that is supposed to send order confirmation emails to customer, admin and restaurant
for some reason the email to the restaurant is not sending.
Could you help by looking at the code and tell me what is missing.
Many thanks.
[php]<?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 .= "----------------------------------------------------- if ($need_address==1) { $msg.="Payment Type : 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 .= “-------------------------------------------------------------------------- if ($need_address==1) { $msg_custemer.="".$GLOBALS[‘email_payment_type’]." : “.$GLOBALS[‘email_best_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($custemer_email,“Order # [$orderId]”,$msg_custemer,$mailheaders);
send_email($custemer_email,$GLOBALS[‘email_order’]." # [$res_id]",$msg_custemer,$mailheaders);
}
[/php]