Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update newsletter modules to support HTML emails

  • Loading branch information...
commit 87ddfae3346d7b3630871626ac3c3b22bd4c4bf1 1 parent 10499e7
@haraldpdl haraldpdl authored
View
12 catalog/admin/includes/modules/newsletters/newsletter.php
@@ -59,8 +59,16 @@ function confirm() {
function send($newsletter_id) {
$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
- $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
- $mimemessage->add_text($this->content);
+ $mimemessage = new email(array('X-Mailer: osCommerce'));
+
+ // Build the text version
+ $text = strip_tags($this->content);
+ if (EMAIL_USE_HTML == 'true') {
+ $mimemessage->add_html($this->content, $text);
+ } else {
+ $mimemessage->add_text($text);
+ }
+
$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);
View
12 catalog/admin/includes/modules/newsletters/product_notification.php
@@ -200,8 +200,16 @@ function send($newsletter_id) {
}
}
- $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
- $mimemessage->add_text($this->content);
+ $mimemessage = new email(array('X-Mailer: osCommerce'));
+
+ // Build the text version
+ $text = strip_tags($this->content);
+ if (EMAIL_USE_HTML == 'true') {
+ $mimemessage->add_html($this->content, $text);
+ } else {
+ $mimemessage->add_text($text);
+ }
+
$mimemessage->build_message();
reset($audience);
View
11 catalog/admin/mail.php
@@ -38,8 +38,15 @@
//Let's build a message object using the email class
$mimemessage = new email(array('X-Mailer: osCommerce'));
- // add the message to the object
- $mimemessage->add_text($message);
+
+ // Build the text version
+ $text = strip_tags($message);
+ if (EMAIL_USE_HTML == 'true') {
+ $mimemessage->add_html($message, $text);
+ } else {
+ $mimemessage->add_text($message);
+ }
+
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
Please sign in to comment.
Something went wrong with that request. Please try again.