function PhpMail::format
Same name in other branches
- 9 core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php \Drupal\Core\Mail\Plugin\Mail\PhpMail::format()
- 8.9.x core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php \Drupal\Core\Mail\Plugin\Mail\PhpMail::format()
- 10 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
1 method overrides PhpMail::format()
- TestHtmlMailCollector::format in core/
modules/ system/ tests/ modules/ mail_html_test/ src/ Plugin/ Mail/ TestHtmlMailCollector.php - Concatenates and wraps the email body for plain-text mails.
File
-
core/
lib/ Drupal/ Core/ Mail/ Plugin/ Mail/ PhpMail.php, line 63
Class
Namespace
Drupal\Core\Mail\Plugin\MailCode
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 (which also wraps the mail body).
$message['body'] = MailFormatHelper::htmlToText($message['body']);
return $message;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.