Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Implimenting a solution?


abubobbob

Recommended Posts

I think ive found a solution to a problem with my emails being sent in a wierd format and containing SSL decoding code at the top of it but im not sure how to impliment his solution. (im not to sure where to insert his code and what file would catalog/order_proccess relates to. Here is the code that this guy said fixed his problem: The last code box he said is his setup for /catalog/order_process.php. I would be gratful if someone with a little more php knowledge could help me out on this one. Thanks.

 

I changed the lines above the tep_mail in /catalog/admin/order.php and deleted the line:

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT. ' #' . tep_db_input($oID), nl2br($email), STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, $extraheaders, $header);

You just need to replace oldeparsonage.com with your domain. I do not get any points from SA now. 
I tried whitelisting before figuring this out, which didn't work to well.
I added a multipart email, so that the email is sent both plain text and html. For your the email your customer receives when placing the order see below. Any questions on how it works/means email me.

 

// some local variables
$from_name = STORE_NAME;
$from_email = STORE_OWNER_EMAIL_ADDRESS;
$to_name = $check_status['customers_name'];
$to_email = $check_status['customers_email_address'];

// headers need to be in the correct order...
$headers = "From: $from_name<$from_email>\n";
$headers .= "Reply-To: <$from_email>\n";
$headers .= "Message-ID: <[email protected]>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"----=_NextPart_000_0008_01C45901.EEDC2260\"\n";
$headers .= "X-Sender: $from_name<$from_email>\n";
$headers .= "X-Mailer: PHP4\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <$from_email>\n";
$subject = "Order #" . $oID;

        $Message .= "This is a multi-part message in MIME format.\n\n";
        $Message .= "------=_NextPart_000_0008_01C45901.EEDC2260\n";
        $Message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
        $Message .= "Content-Transfer-Encoding: quoted-printable\n\n";


        // your plain text message goes here
        $Message .= STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . $oID . "\n" . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n" . "\n" . "Order information is available by using the link below:\n" . HTTP_SERVER . DIR_WS_CATALOG . "account_history_info.php?order_id" . "=3D" . $oID . "\n" . "\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
        $Message .= "\n";
        // End plain text message here
        $Message .= "------=_NextPart_000_0008_01C45901.EEDC2260\n";
        $Message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
  $Message .= "Content-Transfer-Encoding: quoted-printable\n";
        $Message .= "\n";
        // your html goes here -- It didn't appear properly without
        // the weird markup that outlook added after sending
        $Message .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
        $Message .= "<HTML><HEAD>\n";
        $Message .= "<META HTTP-EQUIV=3D\"Content-Type\" content=3D\"text/html; =charset=3Diso-8859-1\">\n";
        $Message .= "<META content=3D\"MSHTML 6.00.2800.1400\" name=3DGENERATOR>\n";
        $Message .= "<STYLE></STYLE></head>\n";
        $Message .= "<BODY><FONT face=3DVerdana size=3D2>\n";
        $Message .= "<img src=3D\"http://www.oldeparsonage.com/logosmall.jpg\"><br>\n";
        $Message .= "<br>\n" . "<hr>" . "<br>\n" . EMAIL_TEXT_ORDER_NUMBER . $oID . "<br>\n" . "<br>\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "<br>\n" . "<br>\n" . "Order information is available by using the link below:<br>\n" . "<a href=3D\"" . HTTP_SERVER . DIR_WS_CATALOG . "account_history_info.php?order_id" . "=3D" . $oID . "\">" . HTTP_SERVER . DIR_WS_CATALOG . "account_history_info.php?order_id" . "=3D" . $oID ."</a><br>\n" . "<br>\n" . $notify_comments . sprintf(EMAIL_HTML_STATUS_UPDATE, $orders_status_array[$status]);
        $Message .= "</FONT></BODY></HTML>\n";
        $Message .= "\n";

        // this ends the message part
        $Message .= "------=_NextPart_000_0008_01C45901.EEDC2260--\n";
        $Message .= "\n";

      mail($check_status['customers_email_address'], $subject, $Message, $headers);

 

 

 

 

 

// lets start with the email confirmation
$email_order = "This is a multi-part message in MIME format.\n\n";

$email_order .= "------=_NextPart_000_0008_01C45901.EEDC2260\n";
$email_order .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$email_order .= "Content-Transfer-Encoding: quoted-printable\n\n";

//Begin plain text message
$email_order .= STORE_NAME . "\n" .
               EMAIL_SEPARATOR . "\n" .
               EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
               EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id' . '=3D' . $insert_id, 'SSL', false) . "\n" .
               EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
if ($order->info['comments']) {
  $email_order .= $order->info['comments'] . "\n\n";
}
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
                EMAIL_SEPARATOR . "\n" .
                $products_ordered .
                EMAIL_SEPARATOR . "\n";

$size = sizeof($order_totals);
for ($i=0; $i<$size; $i++) {
  $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}

$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
                EMAIL_SEPARATOR . "\n" .
                tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n\n" .
                EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                EMAIL_SEPARATOR . "\n" .
                tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
if (is_object($$payment)) {
  $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                  EMAIL_SEPARATOR . "\n";
  $payment_class = $$payment;
  $email_order .= $payment_class->title . "\n\n";
  if ($payment_class->email_footer) {
    $email_order .= $payment_class->email_footer . "\n\n";
  }
}
//End plain text message
// html section begins
$email_order .= "------=_NextPart_000_0008_01C45901.EEDC2260\n";

$email_order .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$email_order .= "Content-Transfer-Encoding: quoted-printable\n";
$email_order .= "\n";

// your html goes here -- It didn't appear properly without
// the weird markup that outlook added after sending
$email_order .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
$email_order .= "<HTML><HEAD>\n";
$email_order .= "<META HTTP-EQUIV=3D\"Content-Type\" content=3D\"text/html; =charset=3Diso-8859-1\">\n";
$email_order .= "<META content=3D\"MSHTML 6.00.2800.1400\" name=3DGENERATOR>\n";
$email_order .= "<STYLE></STYLE></head>\n";
$email_order .= "<BODY><font face=3DVerdana size=3D2>\n";
$email_order .= "<img src=3D\"http://www.oldeparsonage.com/logosmall.jpg\"><br>\n";
$email_order .= "<br>\n" .
               "<hr>" . "<br>\n" .
               EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "<br>\n" .
               EMAIL_TEXT_INVOICE_URL . ' ' . "<a href=3D\"" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id' . '=3D' . $insert_id, 'SSL', false) . "\">" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id' . '=3D' . $insert_id, 'SSL', false). "</a><br>\n" .
               EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "<br><br>\n\n";
if ($order->info['comments']) {
  $email_order .= $order->info['comments'] . "\n\n";
}
$email_order .= "<b>" . EMAIL_TEXT_PRODUCTS . "</b><br>\n" .
                "<hr><br>\n" .
                $products_ordered_html .
                "<hr><br>\n";

$size = sizeof($order_totals);
for ($i=0; $i<$size; $i++) {
  $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "<br>\n";
}

$email_order .= "<br>\n<b>" . EMAIL_TEXT_DELIVERY_ADDRESS . "</b><br>\n" .
                "<hr><br>\n" .
                tep_address_label($customer_id, $sendto, 0, '', "<br>\n") . "<br><br>\n\n" .
                "<b>" . EMAIL_TEXT_BILLING_ADDRESS . "</b><br>\n" .
                "<hr><br>\n" .
                tep_address_label($customer_id, $billto, 0, '', "<br>\n") . "<br><br>\n\n";
if (is_object($$payment)) {
  $email_order .= "<b>" . EMAIL_TEXT_PAYMENT_METHOD . "</b><hr>\n" .
                  "<br>\n";
  $payment_class = $$payment;
  $email_order .= $payment_class->title . "<br><br>\n\n";
  if ($payment_class->email_footer) {
    $email_order .= $payment_class->email_footer . "<br><br>\n\n";
  }
}

$email_order .= "</font></BODY></HTML>\n";
$email_order .= "\n";
//this ends html markup
// this ends the message part
$email_order .= "------=_NextPart_000_0008_01C45901.EEDC2260--\n";
$email_order .= "\n";

// some local variables
$from_name = STORE_NAME;
$from_email = STORE_OWNER_EMAIL_ADDRESS;
$to_name = $order_customer['customers_name'];
$to_email = $order_customer['customers_email_address'];

// headers need to be in the correct order...
$headers = "From: $from_name<$from_email>\n";
$headers .= "Reply-To: <$from_email>\n";
$headers .= "Message-ID: <[email protected]>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"----=_NextPart_000_0008_01C45901.EEDC2260\"\n";
$headers .= "X-Sender: $from_name<$from_email>\n";
$headers .= "X-Mailer: PHP4\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <$from_email>\n";
$subject = "Order #" . $insert_id;

mail($order->customer['email_address'], $subject, $email_order, $headers);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...