public function MailTest::format

Concatenate and wrap the e-mail body for plain-text mails.

Overrides MailInterface::format

See also

Drupal\Core\Mail\PhpMail

File

drupal/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php, line 84
Definition of Drupal\system\Tests\Mail\MailTest.

Class

MailTest
Defines a mail class used for testing.

Namespace

Drupal\system\Tests\Mail

Code

public function format(array $message) {

  // Join the body array into one string.
  $message['body'] = implode("\n\n", $message['body']);

  // Convert any HTML to plain-text.
  $message['body'] = drupal_html_to_text($message['body']);

  // Wrap the mail body for sending.
  $message['body'] = drupal_wrap_mail($message['body']);
  return $message;
}