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_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();
while ($mail = tep_db_fetch_array($mail_query)) {
$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) . "'");
}
}
- osCommerce Support Forum
- → Viewing Profile: tle
Latest News: (loading..)
Community Stats
- Group Community Member
- Active Posts 25 (0.02 per day)
- Most Active In General Add-Ons Support (15 posts)
- Profile Views 2,656
- Age Age Unknown
- Birthday Birthday Unknown
-
Real Name
le
-
Gender
Not Telling
Contact Information
Posts I've Made
In Topic: Newsletter Products, getting repeating products when emailed out
06 August 2011, 05:19
I can move the while loop to the following to solve the problem...but it creates another problem. I wont be able to create a link for each individual customer to unsubscribe.
In Topic: Newsletter Products, getting repeating products when emailed out
06 August 2011, 02:07
germ, on 06 August 2011, 01:41, said:
The problem is that in the loop you just keep adding to the message.
Try changing this code:
Try changing this code:
$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);
}
To: //$mimemessage->add_text($this->content);
//$text = $this->text_content();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage = new email(array('X-Mailer: osCommerce bulk mailer', $messageId));
$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);
unset($mimemessage);
}
The new code builds the message, sends it, then "destroys" it with each pass thru the loop.Hi Jim..
Thanks for your help! I have tried your suggested code, though it does not seem to work. It has the same problem, a repetition of products in each succeeding email. I am really stuck! Any other suggestions?
Thankyou again.
- osCommerce Support Forum
- → Viewing Profile: tle
- Forum Rules






Find content

