public function PhpMail::format in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php \Drupal\Core\Mail\Plugin\Mail\PhpMail::format()
- 9 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 52
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.
$message['body'] = MailFormatHelper::htmlToText($message['body']);
// Wrap the mail body for sending.
$message['body'] = MailFormatHelper::wrapMail($message['body']);
return $message;
}