Improve layout of text/plain emails
authorTim Düsterhus <duesterhus@woltlab.com>
Sun, 31 Jul 2016 19:08:29 +0000 (21:08 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Sun, 31 Jul 2016 19:08:45 +0000 (21:08 +0200)
wcfsetup/install/files/lib/system/email/mime/RecipientAwareTextMimePart.class.php

index 806c86a3ef820021d49c2ba086653194f3b1a934..fd395a591289f763d5926a0caad7d5d6cd5b0bfd 100644 (file)
@@ -90,12 +90,12 @@ class RecipientAwareTextMimePart extends TextMimePart implements IRecipientAware
                                        
                                        return '['.$urls[$matches[1]].']';
                                }, $result);
-                               $result = preg_replace_callback('/(\r?\n-- \r?\n|$)/', function ($matches) use ($urls) {
-                                       $list = '';
+                               $result = preg_replace_callback('/(?:\r?\n)*(\r?\n-- \r?\n|$)/', function ($matches) use ($urls) {
+                                       $list = "\r\n";
                                        foreach ($urls as $url => $number) {
                                                $list .= "\r\n[".$number."] ".$url;
                                        }
-                                       return $list."\r\n".$matches[0];
+                                       return $list."\r\n".$matches[1];
                                }, $result, 1);
                        }