You are here

public function PhpMail::format in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php \Drupal\Core\Mail\Plugin\Mail\PhpMail::format()

Concatenates and wraps the email body for plain-text mails.

Parameters

array $message: A message array, as described in hook_mail_alter().

Return value

array The formatted $message.

Overrides MailInterface::format

File

core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php, line 35
Contains \Drupal\Core\Mail\Plugin\Mail\PhpMail.

Class

PhpMail
Defines the default Drupal mail backend, using PHP's native mail() function.

Namespace

Drupal\Core\Mail\Plugin\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'] = MailFormatHelper::htmlToText($message['body']);

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