function TestHtmlMailCollector::format

Same name in other branches
  1. 9 core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php \Drupal\mail_html_test\Plugin\Mail\TestHtmlMailCollector::format()
  2. 8.9.x core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php \Drupal\mail_html_test\Plugin\Mail\TestHtmlMailCollector::format()
  3. 11.x core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php \Drupal\mail_html_test\Plugin\Mail\TestHtmlMailCollector::format()

Overrides PhpMail::format

File

core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php, line 26

Class

TestHtmlMailCollector
Defines a mail backend that captures sent HTML messages in the state system.

Namespace

Drupal\mail_html_test\Plugin\Mail

Code

public function format(array $message) {
    // Join the body array into one string.
    $message['body'] = implode(PHP_EOL, $message['body']);
    // Wrap the mail body for sending.
    $message['body'] = MailFormatHelper::wrapMail($message['body']);
    return $message;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.