Mail Manager for OSCommerce:
Installation Instructions

Files required for installation can be downloaded from:
The OSCommerce site.

Mail Manager Description

installation:

  • open catalog/includes/languages/english/checkout_process.php, add:define('EMAIL_TEXT_CONFIRM', 'has recommended');
    define('TEXT_FROM', 'from');
  • open/admin/includes/languages/english.php add://mail manager
    define('BOX_HEADING_MAIL_MANAGER', 'Mail Manager');
    define('BOX_MM_BULKMAIL', 'BulkMail Manager');
    define('BOX_MM_TEMPLATES', 'Template Manager');
    define('BOX_MM_EMAIL', 'Send Email');
    define('BOX_MM_RESPONSEMAIL', 'Response Mail');
  • open admin/includes/filenames.php
    add://MAIL MANAGER
    define('FILENAME_MM_RESPONSEMAIL', 'mm_responsemail.php');
    define('FILENAME_MM_TEMPLATES', 'mm_templates.php');
    define('FILENAME_MM_BULKMAIL', 'mm_bulkmail.php');
    define('FILENAME_MM_EMAIL', 'mm_email.php');
  • open admin/includes/database_tables.php
    add:///Mail Manager
    define('TABLE_MM_RESPONSEMAIL', 'mm_responsemail');
    define('TABLE_MM_RESPONSEMAIL_RESTORE', 'mm_responsemail_backup');
    define('TABLE_MM_RESPONSEMAIL_RESET', 'mm_responsemail_reset');
    define('TABLE_MM_TEMPLATES', 'mm_templates');
    define('TABLE_MM_NEWSLETTERS', 'mm_newsletters');
  • open admin/includes/column_left.php add:
    include(DIR_WS_BOXES . 'mail_manager.php');
    just below include(DIR_WS_BOXES . 'modules.php');
  • open admin/includes/classes/email.php, add at the bottom before the closing ?> tag:// eliminate line feeds as <br>
    class emailMailManager extends email {
    function add_html($html, $text = NULL, $images_dir = NULL) {
    $this->html = $html; //tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $html);
    $this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
    if (isset($images_dir)) $this->find_html_images($images_dir);
    }
    }
  • open admin/includes/functions/general.php
    just above the closing ?> tag at the bottom of the page add:///////////////////start mail manager////////////////////////////////////////start mail manager////////////////////////////////////////start mail manager/////////////////////
    function tep_mm_set_mailstatus($mail_id, $status) {
    if ($status == '1') {
    return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '1' where mail_id = '" . (int)$mail_id . "'");
    } elseif ($status == '0') {
    return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '0' where mail_id = '" . (int)$mail_id . "'");
    } else {
    return -1;
    }
    }

    //mail it
    function tep_mm_sendmail($mail, $email_address, $sender_name, $sender, $output_subject, $output_content_html, $output_content_txt) {
    $mimemessage = new emailMailManager(array('X-Mailer: cat/mail_manager.com'));
    // add html and alternative text version
    $mimemessage->add_html($output_content_html, $output_content_txt);
    $mimemessage->build_message(); // encoding -> 76 character linebreak, replacements must be done before
    $mimemessage->send($mail, $email_address, $sender_name, $sender, $output_subject, $output_content_html, $output_content_txt);
    }///////////////////end mail manager////////////////////////////////////////end mail manager////////////////////////////////////////end mail manager/////////////////////

  • open catalog/includes/classes/email.php, add at the bottom before the closing ?> tag:// eliminate line feeds as <br>
    class emailMailManager extends email {
    function add_html($html, $text = NULL, $images_dir = NULL) {
    $this->html = $html; //tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $html);
    $this->html_text = tep_convert_linefeeds(array("\r\n", "\n", "\r"), $this->lf, $text);
    if (isset($images_dir)) $this->find_html_images($images_dir);
    }
    }
  • open catalog/includes/database_tables.php
    add:///Mail Manager
    define('TABLE_MM_RESPONSEMAIL', 'mm_responsemail');
    define('TABLE_MM_RESPONSEMAIL_RESTORE', 'mm_responsemail_backup');
    define('TABLE_MM_RESPONSEMAIL_RESET', 'mm_responsemail_reset');
    define('TABLE_MM_TEMPLATES', 'mm_templates');
    define('TABLE_MM_BULKMAIL', 'mm_bulkmail');
  • open admin/includes/column_left.php add:
    include(DIR_WS_BOXES . 'mail_manager.php');
    just below include(DIR_WS_BOXES . 'modules.php');
  • open catalog/includes/functions/general.php
    just above the closing ?> tag at the bottom of the page add:///////////////////start mail manager////////////////////////////////////////start mail manager////////////////////////////////////////start mail manager/////////////////////
    //
    // Sets the status of a mail item
    function tep_mm_set_mailstatus($mail_id, $status) {
    if ($status == '1') {
    return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '1' where mail_id = '" . (int)$mail_id . "'");
    } elseif ($status == '0') {
    return tep_db_query("update " . TABLE_MM_RESPONSEMAIL . " set status = '0' where mail_id = '" . (int)$mail_id . "'");
    } else {
    return -1;
    }
    }
    //sends it
    function tep_mm_sendmail($mail, $email_address, $sender_name, $sender, $output_subject, $output_content_html, $output_content_txt) {
    $mimemessage = new emailMailManager(array('X-Mailer: ad/mail_manager.com'));
    // add html and alternative text version
    $mimemessage->add_html($output_content_html, $output_content_txt);
    $mimemessage->build_message(); // encoding -> 76 character linebreak, replacements must be done before
    $mimemessage->send($mail, $email_address, $sender_name, $sender, $output_subject, '');
    }
    ///////////////////end mail manager////////////////////////////////////////end mail manager////////////////////////////////////////end mail manager/////////////////////
  • open catalog/tell_a_friend.php.
    1. About line 35 change:
      $product_info_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

      to:
      $product_info_query = tep_db_query("select p.products_image, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

      ( or simply add p.products_image to the query)
    2. About line 100 change:
      tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);

      to//*******start mail manager***************//
      if (file_exists(DIR_WS_MODULES.'mail_manager/tell_a_friend.php')){
      include(DIR_WS_MODULES.'mail_manager/tell_a_friend.php');
      }else{
      tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);
      }
      //*******end mail manager*****************//
  • open admin/orders.php. About line 85 change:
    tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

    to:
    //*******start mail manager****************//
    if (file_exists(DIR_FS_CATALOG_MODULES.'mail_manager/status_update.php')){
    include(DIR_FS_CATALOG_MODULES.'mail_manager/status_update.php');
    }else{
    tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    }
    //********end mail manager****************//
  • open catalog/create_account.php. About line 210 change: tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

    to:
    //*******start mail manager**************//
    if (file_exists(DIR_WS_MODULES.'mail_manager/create_account.php')){
    include(DIR_WS_MODULES.'mail_manager/create_account.php');
    }else{
    tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    }
    //*******end mail manager****************//
  • open catalog/checkout_process.php
    1. about line 350 change:
      tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

      to:
      //*******start mail manager****************//
      if (file_exists(DIR_WS_MODULES.'mail_manager/order_confirm.php')){
      include(DIR_WS_MODULES.'mail_manager/order_confirm.php');
      }else{
      tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
      }
      //*******end mail manager*****************//
    2. about line 245 change
      $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";


      to
      $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n".'<br />';
      (add a break tag)
  • open catalog/password_forgotten change
    tep_mail($check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

    to //*******start mail manager
    if (file_exists(DIR_WS_MODULES.'mail_manager/password_forgotten.php')){
    include(DIR_WS_MODULES.'mail_manager/password_forgotten.php');
    }else{
    tep_mail($check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    }
    //*******end mail manager
  • Upload the files and folders in the folder mail_managers folder. All folders and files are new.
  • Import the sql database file. It adds 5 tables to your database, and does not change any existing tables or configuration. It also loads several sample templates.
  • Create a new field, mmstatus, in the Database in the customers table. The mmstatus.sql file contains command to use in phpmyadmin to create this. This command is posted below:ALTER TABLE `customers` ADD `mmstatus` CHAR( 2 ) NOT NULL AFTER `customers_newsletter`