I think the problem is with the While loop in the function send. I found that if I move the While loop further down the Unsubscribe function no longer works as it does not pick up the correct customer but the repeat products does not occur. Here is the code. Any help is greatly appreciated!
function send($newsletter_id) {
$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
//create id for current mailing
$messageId = "Message-Id: <" . time() . "@" . $_SERVER['SERVER_NAME'] . ">";
$mimemessage = new email(array('X-Mailer: osCommerce bulk mailer', $messageId));
//$mimemessage->add_text($this->content);
//$text = $this->text_content();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->add_html($this->html_content() .'<p align=center><font color="#FFFFFF">' . TEXT_UNSUBSCRIBE . '</font>'. "\n" . '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . TEXT_UNSUBSCRIBE2 . '</a></p>' , $this->text_content() . TEXT_UNSUBSCRIBE . "\n" . tep_catalog_href_link(FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address']));
$mimemessage->build_message();
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
}
$newsletter_id = tep_db_prepare_input($newsletter_id);
tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
}
}






Find content
Not Telling


