diff --git a/core/lib/Drupal/Core/Mail/MailInterface.php b/core/lib/Drupal/Core/Mail/MailInterface.php index 64573ad..22eb8d1 100644 --- a/core/lib/Drupal/Core/Mail/MailInterface.php +++ b/core/lib/Drupal/Core/Mail/MailInterface.php @@ -53,8 +53,8 @@ public function format(array $message); * - subject: Subject of the email to be sent. This must not contain any * newline characters, or the mail may not be sent properly. * - body: Message to be sent. Accepts both CRLF and LF line-endings. - * Email bodies must be wrapped. You can use drupal_wrap_mail() for - * smart plain text wrapping. + * Email bodies must be wrapped. For smart plain text wrapping you can use + * \Drupal\Core\Mail\MailFormatHelper::wrapMail() . * - headers: Associative array containing all additional mail headers not * defined by one of the other parameters. PHP's mail() looks for Cc and * Bcc headers and sends the mail to addresses in these headers too. diff --git a/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php index 1a97b66..3390a4a 100644 --- a/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php +++ b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php @@ -38,7 +38,7 @@ public function format(array $message) { // Convert any HTML to plain-text. $message['body'] = MailFormatHelper::htmlToText($message['body']); // Wrap the mail body for sending. - $message['body'] = drupal_wrap_mail($message['body']); + $message['body'] = MailFormatHelper::wrapMail($message['body']); return $message; } diff --git a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php index 57de914..de76c13 100644 --- a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php +++ b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php @@ -362,28 +362,29 @@ public function testVeryLongLineWrap() { } /** - * Tests that drupal_wrap_mail() removes trailing whitespace before newlines. + * Tests that trailing whitespace is removed before newlines. + * @see \Drupal\Core\Mail\MailFormatHelper::wrapMail() */ public function testRemoveTrailingWhitespace() { $text = "Hi there! \nHerp Derp"; - $mail_lines = explode("\n", drupal_wrap_mail($text)); + $mail_lines = explode("\n", MailFormatHelper::wrapMail($text)); $this->assertNotEqual(" ", substr($mail_lines[0], -1), 'Trailing whitespace removed.'); } /** - * Tests that drupal_wrap_mail() does not remove the trailing whitespace from - * Usenet style signatures. + * Tests that \Drupal\Core\Mail\MailFormatHelper::wrapMail() does not remove + * the trailing whitespace from Usenet style signatures. * * RFC 3676 says, "This is a special case; an (optionally quoted or quoted and * stuffed) line consisting of DASH DASH SP is neither fixed nor flowed." */ public function testUsenetSignature() { $text = "Hi there!\n-- \nHerp Derp"; - $mail_lines = explode("\n", drupal_wrap_mail($text)); + $mail_lines = explode("\n", MailFormatHelper::wrapMail($text)); $this->assertEqual("-- ", $mail_lines[1], 'Trailing whitespace not removed for dash-dash-space signatures.'); $text = "Hi there!\n-- \nHerp Derp"; - $mail_lines = explode("\n", drupal_wrap_mail($text)); + $mail_lines = explode("\n", MailFormatHelper::wrapMail($text)); $this->assertEqual("--", $mail_lines[1], 'Trailing whitespace removed for incorrect dash-dash-space signatures.'); } } diff --git a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php index f1f4258..a0dd6ae 100644 --- a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php @@ -17,7 +17,7 @@ class MailFormatHelperTest extends UnitTestCase { /** - * Makes sure that drupal_wrap_mail() wraps the correct types of lines. + * @covers ::wrapMail */ public function testWrapMail() { $delimiter = "End of header\n";