diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index 84070e356..1b32c7ddb 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -1333,6 +1333,8 @@ class e107Email extends PHPMailer $this->Body = $message; //print_a($message); $textMsg = str_replace("\n", "", $message); + $textMsg = str_replace('', "\t", $textMsg); + $textMsg = str_replace("", "\n", $textMsg); $textMsg = str_replace(array('
', '
'), "\n", $textMsg); // Modified to make sure newlines carried through $textMsg = preg_replace('#^.*?#', '', $textMsg); // Knock off everything up to and including the body statement (if present) $textMsg = preg_replace('#.*$#', '', $textMsg); // Knock off everything after and including the (if present) @@ -1355,7 +1357,7 @@ class e107Email extends PHPMailer $this->AltBody = 'To view this email message, enable HTML!' . "\n\n"; } - return $this->Body; + return $this->Body; } diff --git a/e107_tests/tests/unit/e107EmailTest.php b/e107_tests/tests/unit/e107EmailTest.php index 8e72ea297..65c4ad945 100644 --- a/e107_tests/tests/unit/e107EmailTest.php +++ b/e107_tests/tests/unit/e107EmailTest.php @@ -83,12 +83,34 @@ { } - +*/ public function testMsgHTML() { + $html = "\n +Hi Joe
+ +Check out http://e107.org
+
+Thanks,
+Admin
+
+ + + + + + +
Website:https://e107.org
Github:https://github.com/e107inc/
"; + + + $this->eml->MsgHTML($html); + + $result = json_encode($this->eml->AltBody); + $expected = '"Hi Joe\\nCheck out http:\\/\\/e107.org\\n\\nThanks,\\nAdmin\\n\\nWebsite:\\thttps:\\/\\/e107.org\\t\\nGithub:\\thttps:\\/\\/github.com\\/e107inc\\/"'; + $this->assertSame($expected, $result); } - +/* public function testSendEmail() {