Reply to comment

PHPList Tweak for Plain Text Version of HTML Mail

This small alteration to the PHPList code will produce better line breaks.

sendemaillib.php:

  $text = preg_replace("/<\/p\s*?>/i","<\/p>\n\n",$text);
  $text = preg_replace("/<br>/i","<br />",$text);
  $text = preg_replace("/<br \/>\n+/i","<br />",$text);
  $text = preg_replace("/<br \/>/i","<br />\n",$text);
  $text = preg_replace("/<table/i","\n\n<table",$text);

The technique is to first normalize br to br /, then remove line newlines after br tags. Then, you re-introduce newlines, so each br has only one newline after it.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul> <p> <br> <div> <pre> <code> <img><h1><h2><h3><h4> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

.