Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DefaultMailSystem::format

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

Parameters

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

Return value

The formatted $message.

Overrides MailSystemInterface::format

File

modules/system/system.mail.inc, line 21

Class

DefaultMailSystem
The default Drupal mail backend using PHP's mail function.

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 and wrap the mail body for sending.
 $message['body'] = drupal_html_to_text ($message['body']);
 return $message;
}

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