diff -urp print/print_mail/print_mail.inc print-attachment/print_mail/print_mail.inc --- print/print_mail/print_mail.inc 2009-10-03 12:52:10.000000000 -0400 +++ print-attachment/print_mail/print_mail.inc 2009-10-23 21:30:11.875000000 -0400 @@ -85,6 +85,16 @@ function print_mail_form($form_state) { '#title' => t('Page to be sent'), '#value' => l($title, $path, array('attributes' => array('title' => t('View page')))), ); + $form['fld_send_option'] = array ( + '#type' => 'select', + '#title' => t('Send page as'), + '#default_value' => 'plain-attachment', + '#options' => array( + 'sendpage' => 'Inline HTML', + 'inline-attachment' => 'Inline HTML with Attachment', + 'plain-attachment' => 'Plain Text with Attachment', + ), + ); $form['txt_message'] = array( '#type' => 'textarea', '#title' => t('Your message'), @@ -155,6 +165,7 @@ function theme_print_mail_form($form) { case 'txt_to_addrs': case 'fld_subject': case 'fld_title': + case 'fld_send_option': $tmp = str_replace('setTXTBody($params['message']); + if ($params['send_option'] == 'inline-attachment') { + $mime->setHTMLBody($params['body']); + } + $mime->addAttachment($params['body'],'text/html','test-file.html',false); + + // Store MIME message output in message array + $message['body'] = $mime->get($mime_params); + $message['headers'] = $mime->headers($message['headers']); + + // Strip special characters from Content-Type header + // Required to prevent mime_header_encode() from disrupting Content-Type header + $message['headers']['Content-Type'] = preg_replace('/[^\x20-\x7E]/','', $message['headers']['Content-Type']); + break; } }