You are here

function print_mail_mail in Printer, email and PDF versions 5.3

Same name and namespace in other branches
  1. 6 print_mail/print_mail.inc \print_mail_mail()
  2. 7.2 print_mail/print_mail.module \print_mail_mail()
  3. 7 print_mail/print_mail.module \print_mail_mail()
  4. 5.x print_mail/print_mail.inc \print_mail_mail()

Implementation of hook_mail().

1 call to print_mail_mail()
print_mail_form_submit in print_mail/print_mail.inc
Process the send by-email form submission.

File

print_mail/print_mail.inc, line 242

Code

function print_mail_mail($key, &$message, $params) {
  switch ($key) {
    case 'sendpage':
      $sender_message = t('Message from sender:') . '<br /><br /><em>' . nl2br($params['message']) . '</em>';
      $print = print_controller($params['path'], $params['cid'], $params['teaser'], $sender_message);
      if ($print === FALSE) {
        return;
      }

      // Img elements must be set to absolute
      //      $pattern = '!<(img\s[^>]*?)>!is';
      //      $print['content'] = preg_replace_callback($pattern, '_print_rewrite_urls', $print['content']);
      //      $print['logo'] = preg_replace_callback($pattern, '_print_rewrite_urls', $print['logo']);
      //      $print['footer_message'] = preg_replace_callback($pattern, '_print_rewrite_urls', $print['footer_message']);
      $node = $print['node'];
      ob_start();
      include_once _print_get_template('mail', $print['type']);
      $html = ob_get_contents();
      ob_end_clean();
      $message['subject'] = $params['subject'];
      $message['body'] = $html;
      $message['headers']['Content-Type'] = 'text/html; charset=utf-8';
      break;
  }
}