You are here

public function DrupalPHPMailer::format in PHPMailer 7.3

Same name and namespace in other branches
  1. 7.4 includes/phpmailer.class.inc \DrupalPHPMailer::format()

Concatenates and wraps the e-mail body for plain-text mails.

Mails contain HTML by default. When using PHPMailer without MimeMail module, plain-text e-mails are sent, which require the same processing as in the DefaultMailSystem implementation.

Parameters

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

Return value

array The formatted $message.

Overrides MailSystemInterface::format

See also

DefaultMailSystem::format()

File

includes/phpmailer.class.inc, line 243
Implements the base PHPMailer for Drupal class.

Class

DrupalPHPMailer
Class for implementing the PHPMailer library in Drupal.

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;
}