Jump to content

Oscommerce Sendmail


Recommended Posts

I have just setup osCommerce with paypal as my payment gateway. I have all of my modules working properly. I received my first order through osCommerce, however it was Paypal email that notified me. After enabling my SpamBox, I saw that email coming throught osCommerce where receiving high points for this error: "3.3 MSGID_FROM_MTA_SHORT Message-Id was added by a relay". I looked at the email header and it looks like this:

 

Received: from nobody by server38.totalchoicehosting.com with local (Exim 4.24)

id 1BNiUn-0003di-Pt

for jomcfred@oldeparsonage.com; Tue, 11 May 2004 20:25:17 -0500

To: "Joe Frederick" <jomcfred@oldeparsonage.com>

Subject: testt

From: Olde Parsonage <'orders@oldeparsonage.com'>

MIME-Version: 1.0

X-Mailer: osCommerce bulk mailer

Content-Type: text/plain; charset="iso-8859-1"

Content-Transfer-Encoding: 7bit

Message-Id: <E1BNiUn-0003di-Pt@server38.totalchoicehosting.com>

Date: Tue, 11 May 2004 20:25:17 -0500

X-Spam-Exim: uph3SWpzdCbRAUuy8fxBlHxB

 

How can I configure osCommerce to sendmail and add tch server info, so that it isn't spam?

Link to comment
Share on other sites

I figured it out after reading some rfc's

 

// some local variables

$from_name = STORE_NAME;

$from_email = STORE_OWNER_EMAIL_ADDRESS;

$to_name = $check_status['customers_name']; //This variable needs to be changed based on what file it's calling from

$to_email = $check_status['customers_email_address']; //This variable needs to be changed based on what file it's calling from

 

 

// headers need to be in the correct order...

$extraheaders = "From: $from_name<$from_email>\n";

$extraheaders .= "Reply-To: <$from_email>\n";

$extraheaders .= "Message-ID: <002301c4381d$bbe6ee90$6400a8c0@oldeparsonage.com>\n";

$extraheaders .= "MIME-Version: 1.0\n";

$extraheaders .= "X-Sender: $from_name<$from_email>\n";

$extraheaders .= "X-Mailer: PHP4\n"; //mailer

$extraheaders .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal

$extraheaders .= "Return-Path: <$from_email>\n";

 

Mail($to_name, $to_email, $subject, $message, $from_name, $from_email, $extraheaders, $headers)

Link to comment
Share on other sites

  • 2 months later...

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.

 

Thanks,

Joe

 

>// 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: <002301c4381d$bbe6ee90$6400a8c0@oldeparsonage.com>\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);

 

Here is my setup for /catalog/order_process.php. This code creates a plain text/html message when they confirm their order.

 

>// 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: <002301c4381d$bbe6ee90$6400a8c0@oldeparsonage.com>\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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...