You are here

public function MimeMailSystem::format in Mime Mail 7

Concatenate and wrap the e-mail body for HTML mails.

Parameters

array $message: A message array, as described in hook_mail_alter() with optional parameters described in mimemail_prepare_message().

Return value

array The formatted $message.

Overrides MailSystemInterface::format

File

includes/mimemail.mail.inc, line 23
Mime Mail implementations of MailSystemInterface.

Class

MimeMailSystem
Modify the Drupal mail system to send HTML emails.

Code

public function format(array $message) {
  if (is_array($message['body'])) {
    $message['body'] = implode("\n\n", $message['body']);
  }
  if (preg_match('/plain/', $message['headers']['Content-Type'])) {
    $message['body'] = check_markup($message['body'], variable_get('mimemail_format', filter_fallback_format()));
  }
  $engine = variable_get('mimemail_engine', 'mimemail');
  $engine_prepare_message = $engine . '_prepare_message';
  if (function_exists($engine_prepare_message)) {
    $message = $engine_prepare_message($message);
  }
  else {
    $message = mimemail_prepare_message($message);
  }
  return $message;
}