Jump to content

sammedit

Members
  • Content count

    85
  • Joined

  • Last visited


Reputation Activity

  1. Like
    sammedit got a reaction from npn2531 in Mail Manager   
    @@npn2531
     
    For some reason this site won't let me email you. So here it is:
     
    Mail Manager Newsletter Unsubscribe Add On
     
     
     
    Add these two files to your catalog directory:
     
    unsubscribe.php

    <?php //////////////////////////////////////////////////////////////////////////// // $Id: Newsletter Unsubscribe, v 1.0 (/catalog/unsubscribe.php) 2003/01/24 // Programed By: Christopher Bradley (www.wizardsandwars.com) // // Developed for osCommerce, Open Source E-Commerce Solutions // http://www.oscommerce.com // Copyright (c) 2003 osCommerce // // Released under the GNU General Public License // /////////////////////////////////////////////////////////////////////////// require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_UNSUBSCRIBE); if (isset($HTTP_GET_VARS['email'])) { $email_to_unsubscribe = ereg_replace('[^0-9A-Za-z@._-]', '', $HTTP_GET_VARS['email']); } else { $email_to_unsubscribe = ''; } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_UNSUBSCRIBE, '', 'NONSSL')); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo UNSUBSCRIBE_TEXT_INFORMATION; ?></td> </tr> </table></td> </tr> <tr> <td align="center" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_UNSUBSCRIBE_DONE, 'email=' . $email_to_unsubscribe, 'NONSSL') . '">' . tep_image_button('button_unsubscribe.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> </tr> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
     
     
    unsubscribe_done.php

    <?php //////////////////////////////////////////////////////////////////////////// // $Id: Newsletter Unsubscribe, v 1.0 (/catalog/unsubscribe_done.php) 2003/01/24 // Programed By: Christopher Bradley (www.wizardsandwars.com) // // Developed for osCommerce, Open Source E-Commerce Solutions // http://www.oscommerce.com // Copyright (c) 2003 osCommerce // // Released under the GNU General Public License // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_UNSUBSCRIBE); if (isset($HTTP_GET_VARS['email'])) { $email_to_unsubscribe = ereg_replace('[^0-9A-Za-z@._-]', '', $HTTP_GET_VARS['email']); } else { $email_to_unsubscribe = ''; } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_UNSUBSCRIBE, '', 'NONSSL')); // Check and see if the email exists in the database, and is subscribed to the newsletter. $cus_subscribe_raw = "select 1 from " . TABLE_CUSTOMERS . " where customers_newsletter = '1' and customers_email_address = '" . $email_to_unsubscribe . "'"; $cus_subscribe_query = tep_db_query($cus_subscribe_raw); $cus_subscribe = tep_db_fetch_array($cus_subscribe_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?php // If we found the customers email address, and they currently subscribe if ($cus_subscribe) { // Unsubscribe them tep_db_query("update " . TABLE_CUSTOMERS . " set customers_newsletter = '0' where customers_email_address = '" . $email_to_unsubscribe . "'"); ?> <td class="main"><?php echo UNSUBSCRIBE_DONE_TEXT_INFORMATION . $email_to_unsubscribe; ?></td> <?php // Otherwise, we want to display an error message (This should never occur, unless they try to unsubscribe twice) } else { ?> <td class="main"><?php echo UNSUBSCRIBE_ERROR_INFORMATION . $email_to_unsubscribe; ?></td> <?php } ?> </tr> </table></td> </tr> <tr> <td align="center" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> </tr> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
     
    Then add catalog/includes/languages/english/unsubscribe.php

    <?php //////////////////////////////////////////////////////////////////////////// // $Id: Newsletter Unsubscribe, (/catalog/includes/languages/english/unsubscribe.php)v 1.2 2004/04/29 // Programed By: Christopher Bradley (www.wizardsandwars.com) // Modified by Jim Keebaugh // // Developed for osCommerce, Open Source E-Commerce Solutions // http://www.oscommerce.com // Copyright (c) 2003 osCommerce // // Released under the GNU General Public License // /////////////////////////////////////////////////////////////////////////// define('NAVBAR_TITLE', 'Unsubscribe'); define('HEADING_TITLE', 'Unsubscribe from our Newsletter'); define('UNSUBSCRIBE_TEXT_INFORMATION', '<br>We\'re sorry to hear that you wish to unsubscribe from our newsletter. If you have concerns about your privacy, please see our <a href="' . FILENAME_PRIVACY . '"><u>privacy notice</u></a>.<br><br>Subscribers to our newsletter are kept notified of new products, price reductions, and site news.<br><br>If you still do not wish to receive your newsletter, please click the button below. '); define('UNSUBSCRIBE_DONE_TEXT_INFORMATION', '<br>Your email address, listed below, has been removed from our Newsletter Subscription list, as per your request. <br><br>'); define('UNSUBSCRIBE_ERROR_INFORMATION', '<br>The email address listed below was not found in our newsletter database, or has already been removed from our newletter subscription list. <br><br>'); ?>
     
     
    Then create an unsubscribe button and post as catalog/includes/languages/english/images/buttons/button_unsubscribe.gif or draw your own and change applicable code.
     
    EDITS:
     
    admin/includes/modules/newsletters/newsletter.php
     
    Find:

    $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text($this->content); $mimemessage->build_message(); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); }
     
    Change to:

    // Begin Unsubscribe $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); while ($mail = tep_db_fetch_array($mail_query)) { $mimemessage->add_html($this->content . TEXT_UNSUBSCRIBE . '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>'); $mimemessage->build_message(); $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } // End Unsubscribe
     
    In /catalog/includes/filenames.php
     
    Add:

    /// Begin Unsubscribe define('FILENAME_UNSUBSCRIBE', 'unsubscribe.php'); define('FILENAME_UNSUBSCRIBE_DONE', 'unsubscribe_done.php'); /// End Unsubscribe
     
    In admin/includes/languages/english/modules/newsletters/newsletter.php
    and admin/includes/languages/english/mm_bulkmail.php
     
    Add:

    /// Begin Unsubscribe define('TEXT_UNSUBSCRIBE', "\n\nTo unsubscribe from this newsletter, just click on the following link:\n"); /// End Unsubscribe
     
     
    In admin/includes/filenames.php
     
    Add:

    //// Begin Unsubscribe define('FILENAME_UNSUBSCRIBE', 'unsubscribe.php'); //// End Unsubscribe
     
    Then in admin/mm_bulkmail.php
     
    Find:

    // compile mailpiece $output_content_html= $template['htmlheader'].$newsletter['content'].$template['htmlfooter']; $output_content_txt= $template['txtheader'].$newsletter['txtcontent'].$template['txtfooter']; // placeholders $placeholders=array('storeurl', 'storeowner','storeemail'); $values=array(HTTP_SERVER,STORE_OWNER,STORE_OWNER_EMAIL_ADDRESS); $output_content_html=str_replace($placeholders, $values, $output_content_html); // get customer selection criteria and additional content from module require(DIR_WS_MODULES . 'mail_manager/' . $newsletter['module'] . substr($PHP_SELF, strrpos($PHP_SELF, '.')));
     
    and replace with:
     

    // compile mailpiece $output_content_html= $template['htmlheader'].$newsletter['content'].$template['htmlfooter']; $output_content_txt= $template['txtheader'].$newsletter['txtcontent'].$template['txtfooter']; require(DIR_WS_MODULES . 'mail_manager/' . $newsletter['module'] . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); $unsubscribe = TEXT_UNSUBSCRIBE . '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>'; // placeholders $placeholders=array('storeurl', 'storeowner','storeemail', '$unsubscribe'); $values=array(HTTP_CATALOG_SERVER,STORE_OWNER,STORE_OWNER_EMAIL_ADDRESS, $unsubscribe); $output_content_html=str_replace($placeholders, $values, $output_content_html);
     
    Then add $unsubscribe into your newsletter or into the template.
     
    I think that is it. It will also add an unsubscribe link to your stock newsletter setup. Let me know if you get it to work.
     
    sammedit
×