You are here

function update_detailed_email_mail_alter in Update Status Detailed Email 7

Same name and namespace in other branches
  1. 6 update_detailed_email.module \update_detailed_email_mail_alter()

Implements hook_mail_alter().

The update status email needs to be intercepted so it can be changed to HTML.

File

./update_detailed_email.module, line 68
Adds detail to the email message Drupal core's Update Status sends.

Code

function update_detailed_email_mail_alter(&$message) {
  if ($message['id'] == 'update_status_notify') {
    if (module_exists('update')) {
      module_load_include('inc', 'update', 'update.report');
      if (function_exists('update_status')) {
        if (_update_detailed_email_is_html()) {
          $message['headers']['Content-Type'] = 'text/html';
        }
        if (module_exists('token')) {
          $message['subject'] = token_replace(variable_get('update_detailed_email_subject', _update_detailed_email_default_subject()));
        }
        else {
          $message['subject'] = variable_get('update_detailed_email_subject', _update_detailed_email_default_subject());
        }
        foreach ($message['body'] as &$part) {
          $part = '<p>' . $part . '</p>';
        }
        $message['body'] = array(
          implode("\n\n", $message['body']),
        );
        $message['body'][] = update_status();
      }
    }
  }
}