I am trying to send the "extra" order confirmation emails to different addresses, based on suburb.. Here is what I have tried, but get errors..
$regionalquery = "Select suburb_email from suburb where suburb_name = '" .$order->customer['suburb'] . "'";
$regionalemail = tep_db_query ($regionalquery)or die("Query failed");
// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$email_order = $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n" . 'Telephone: ' . $order->customer['telephone'] . "\n" . 'Region:' . $order->customer['suburb'] . "\n" . $order->customer['email_address'] . "\n\n" . 'Print Invoice: ' . "<A HREF='" . tep_href_link(FILENAME_INVOICE_PRINT, 'oID=' . $insert_id, 'SSL', false) . "'>" . tep_href_link(FILENAME_INVOICE_PRINT, 'oID=' . $insert_id, 'SSL', false) . "</a>\n\n" . 'Administration Link: ' . "<A HREF='" . tep_href_link(FILENAME_ADMIN_LINK) . "'>" . tep_href_link(FILENAME_ADMIN_LINK) . "</a>\n\n" . $email_order;
tep_mail('', $regionalemail, 'NEW - ' . EMAIL_TEXT_SUBJECT . ' #' . $insert_id, $email_order, STORE_OWNER, $regionalemail);
}
and here is the error I get:
Warning: mail() expects parameter 1 to be string, resource given in /home/mysite/public_html/catalog/includes/classes/email.php on line 502
Any help would be appreciated.
$regionalquery = "Select suburb_email from suburb where suburb_name = '" .$order->customer['suburb'] . "'";
$regionalemail = tep_db_query ($regionalquery)or die("Query failed");
// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
$email_order = $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n" . 'Telephone: ' . $order->customer['telephone'] . "\n" . 'Region:' . $order->customer['suburb'] . "\n" . $order->customer['email_address'] . "\n\n" . 'Print Invoice: ' . "<A HREF='" . tep_href_link(FILENAME_INVOICE_PRINT, 'oID=' . $insert_id, 'SSL', false) . "'>" . tep_href_link(FILENAME_INVOICE_PRINT, 'oID=' . $insert_id, 'SSL', false) . "</a>\n\n" . 'Administration Link: ' . "<A HREF='" . tep_href_link(FILENAME_ADMIN_LINK) . "'>" . tep_href_link(FILENAME_ADMIN_LINK) . "</a>\n\n" . $email_order;
tep_mail('', $regionalemail, 'NEW - ' . EMAIL_TEXT_SUBJECT . ' #' . $insert_id, $email_order, STORE_OWNER, $regionalemail);
}
and here is the error I get:
Warning: mail() expects parameter 1 to be string, resource given in /home/mysite/public_html/catalog/includes/classes/email.php on line 502
Any help would be appreciated.