You are here

function phpmailer_preview in PHPMailer 7.3

Same name and namespace in other branches
  1. 5.2 phpmailer.module \phpmailer_preview()
  2. 6.3 phpmailer.admin.inc \phpmailer_preview()
  3. 6 phpmailer.module \phpmailer_preview()
  4. 6.2 phpmailer.admin.inc \phpmailer_preview()
  5. 7.4 phpmailer.admin.inc \phpmailer_preview()

Renders an HTML mail preview in the browser.

@todo Move to Mime Mail project.

1 string reference to 'phpmailer_preview'
phpmailer_menu in ./phpmailer.module
Implements hook_menu().

File

./phpmailer.admin.inc, line 355
Administrative functions for PHPMailer integration module.

Code

function phpmailer_preview() {
  global $user;

  // Suppress devel output in preview.
  $GLOBALS['devel_shutdown'] = TRUE;
  $mailkey = 'phpmailer_preview';

  // @see user_register_submit()
  $language = user_preferred_language($user);
  $variables = user_mail_tokens($user, $language);
  $variables['!password'] = 'test';
  $body = _user_mail_text('register_no_approval_required_body', $language, $variables);

  // Convert non-html messages.
  // @see drupal_mail_wrapper()
  $format = variable_get('mimemail_format', FILTER_FORMAT_DEFAULT);
  $body = check_markup($body, $format, FALSE);

  // @see mimemail_prepare()
  $body = theme('mimemail_message', $body, $mailkey);
  foreach (module_implements('mail_post_process') as $module) {
    $function = $module . '_mail_post_process';
    $function($body, $mailkey);
  }
  print $body;
  drupal_exit();
}