Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Email/Newsletter HTML Corrupt


KennethS

Recommended Posts

Hello,

 

When sending newsletter's or emails it is becoming trashed in the process, even in the preview. I am pasting straight HTML code into the text field for newsletters/email. The HTML does include tables and CSS. When I open the newsletter code (local harddrive) in any html editor/web browser it looks perfect, but when sent via OSC Admin it becomes garbled in most email applications and the preview in OSC Admin. The most luck I had was receiving it in the Mail program that comes with Mac OSX which displayed it...after 20 inches of white space above it for no apparent reason. If anyone has any ideas on how to fix this I would greatly appreciate it because I've scoured the forums without much luck.

 

Thanks,

 

Kenneth S.

Kenneth S

--------------

Customer "Are you a real programmer?"

Me "No, but I did stay at a Holiday Inn Express last night"

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

This was a hard day, but finally I think that catch the solution.

 

In admin/includes/classes/email.php, around line #159 we can read this code

 

/**
* Adds a html part to the mail.
* Also replaces image names with
* content-id's.
*/

   function add_html($html, $text = NULL, $images_dir = NULL) {
     $this->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);
   }

 

This code inserts <br> at the end of each line, and it brokes your original newsletter code.

 

My solution was: replace '<br>' with $this->lf ... and now it works fine in my site.

 

Please, all opinions are wellcome to refine this solution.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...