PHPList Tweak for Plain Text Version of HTML Mail

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


  $text = preg_replace("/</ps*?>/i","</p>nn",$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","nn<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.