Skip to content

Commit 0825a07

Browse files
janbarasekdg
andcommitted
Message::buildText(): Trim each text line. (#84)
Co-authored-by: David Grudl <[email protected]>
1 parent d06b1a1 commit 0825a07

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Mail/Message.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ protected function buildText(string $html): string
397397
]);
398398
$text = Nette\Utils\Html::htmlToText($html);
399399
$text = Strings::replace($text, '#[ \t]+#', ' ');
400+
$text = implode("\n", array_map('trim', explode("\n", $text)));
400401
return trim($text);
401402
}
402403

tests/Mail/Mail.HtmlBodyAndLinks.multiline.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Content-Type: text/plain; charset=UTF-8
5050
Content-Transfer-Encoding: 8bit
5151
5252
Příliš žluťoučký <http://green.example.com>
53-
žlutý kůň <http://horse.example.com>
53+
žlutý kůň <http://horse.example.com>
5454
----------%S%
5555
Content-Type: text/html; charset=UTF-8
5656
Content-Transfer-Encoding: 8bit

0 commit comments

Comments
 (0)