Index: mimemail/mimemail.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/mimemail.inc,v
retrieving revision 1.25
diff -u -p -r1.25 mimemail.inc
--- mimemail/mimemail.inc	3 Aug 2008 01:02:41 -0000	1.25
+++ mimemail/mimemail.inc	4 Aug 2008 13:43:07 -0000
@@ -1,5 +1,5 @@
 <?php
-/* $Id: mimemail.inc,v 1.25 2008/08/03 01:02:41 vauxia Exp $ */
+// $Id: mimemail.inc,v 1.25 2008/08/03 01:02:41 vauxia Exp $
 
 /**
  * @file
@@ -143,7 +143,8 @@ function _mimemail_file($file = NULL, $t
   if ($file && !preg_match('@://|mailto:@', $file) && file_exists($file)) {
     $content_id = md5($file) .'@'. $_SERVER['HTTP_HOST'];
 
-    $new_file = array('name' => substr($file, strrpos($file, '/') + 1),
+    $new_file = array(
+      'name' => substr($file, strrpos($file, '/') + 1),
       'file' => $file,
       'Content-ID' => $content_id,
       'Content-Disposition' => $disposition,
@@ -255,7 +256,9 @@ function mimemail_multipart_body($parts,
         $part_headers['Content-Disposition'] .= '; filename="'. $part['name'] .'"';
       }
 
-      $part_body = chunk_split(base64_encode(file_get_contents($part['file'])));
+      if (isset($part['file'])) {
+        $part_body = chunk_split(base64_encode(file_get_contents($part['file'])));
+      }
     }
 
     $body .= "\n--$boundary\n";
@@ -519,7 +522,7 @@ function _mimemail_url($url) {
     return '#'. $fragment;
   }
 
-  return url($path, $query, $fragment, TRUE);
+  return url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => TRUE));
 }
 
 /**
Index: mimemail/mimemail.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/mimemail.info,v
retrieving revision 1.1
diff -u -p -r1.1 mimemail.info
--- mimemail/mimemail.info	5 Jan 2007 05:44:09 -0000	1.1
+++ mimemail/mimemail.info	4 Aug 2008 13:43:07 -0000
@@ -2,3 +2,4 @@
 name = Mime Mail
 description = E-mail with HTML and attachments
 package = Mail
+core = 6.x
\ No newline at end of file
Index: mimemail/mimemail.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/mimemail.module,v
retrieving revision 1.25
diff -u -p -r1.25 mimemail.module
--- mimemail/mimemail.module	3 Aug 2008 01:02:41 -0000	1.25
+++ mimemail/mimemail.module	4 Aug 2008 13:43:08 -0000
@@ -1,32 +1,33 @@
-<?php /* $Id: mimemail.module,v 1.25 2008/08/03 01:02:41 vauxia Exp $ */
+<?php 
+// $Id: mimemail.module,v 1.25 2008/08/03 01:02:41 vauxia Exp $
 
 /**
- * @file Component module for sending Mime-encoded emails
+ * @file 
+ * Component module for sending Mime-encoded emails
+ *
  */
  
 /**
  * Implementation of hook_menu()
  */
 function mimemail_menu() {
-  $items[] = array(
-    'path' => 'admin/settings/mimemail',
-    'title' => t('Mail'),
-    'description' => t('HTML E-mail settings'),
-    'callback' => 'drupal_get_form',
-    'callback arguments' => 'mimemail_settings',
-    'access' => user_access('administer site configuration'),
+  $items['admin/settings/mimemail'] = array(
+    'title' => 'Mime Mail',
+    'description' => 'HTML E-mail settings',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('mimemail_admin_settings'),
+    'access arguments' => array('administer site configuration'),
     'type' => MENU_NORMAL_ITEM,
   );
-  $items[] = array(
-    'path' => 'mimemail',
-    'callback' => 'mimemail_post',
-    'access' => variable_get('mimemail_incoming', FALSE),
+  $items['mimemail'] = array(
+    'page callback' => 'mimemail_post',
+    'access callback' => variable_get('mimemail_incoming', FALSE),
     'type' => MENU_CALLBACK,
   );
   return $items;
 }
 
-function mimemail_settings() {
+function mimemail_admin_settings() {
 
   // override the smtp_library value if mimemail is chosen to handle all mail
   // this will cause drupal_mail to call mimemail()
@@ -161,7 +162,6 @@ function mimemail_user($op, &$edit, &$us
  * @return result from mail() call
  */
 function mimemail_prepare($sender, $recipient, $subject, $body, $plaintext = NULL, $headers = array(), $text = NULL, $attachments = array(), $mailkey = '') {
-
   require_once dirname(__FILE__) .'/mimemail.inc';
 
   if (is_null($sender)) {        // use site default for sender
@@ -202,6 +202,21 @@ function mimemail_prepare($sender, $reci
   return $message;
 }
 
+/**
+ * Entrance function for processing mail information. Calls hook_mailengine(),
+ * which is custom to this module.
+ *
+ * @param string  $sender
+ * @param string  $recipient
+ * @param string  $subject
+ * @param string  $body
+ * @param bool    $plaintext    TRUE: send e-mail as plain text; FALSE send as html
+ * @param array   $headers
+ * @param string  $text         plain text version of $body
+ * @param array   $attachments
+ * 
+ * @return bool
+ */
 function mimemail($sender, $recipient, $subject, $body, $plaintext = NULL, $headers = array(), $text = NULL, $attachments = array(), $mailkey = '') {
 
   $engine = variable_get('mimemail_engine', 'mimemail') .'_mailengine';
@@ -257,7 +272,7 @@ function mimemail_mailengine($op, $messa
       return t('Mime Mail');
 
     case 'description':
-      return t("Default mailing engine using drupal_mail().");
+      return t('Default mailing engine using drupal_mail().');
 
     case 'settings': //not implemented
       return FALSE;
@@ -287,21 +302,17 @@ function mimemail_mailengine($op, $messa
 if (strpos(variable_get('smtp_library', ''), 'mimemail')
   && !function_exists('drupal_mail_wrapper')) {
 
-  function drupal_mail_wrapper($mailkey, $to, $subject, $body, $from, $headers) {
+  function drupal_mail_wrapper(&$message) {
+    $to = $message['to'];
+    $from = $message['from'];
+    $subject = $message['subject'];
+    $body = $message['body'];
+    $headers = isset($message['headers']) ? $message['headers'] : array();
+    $mailkey = isset($message['mailkey']) ? $message['mailkey'] : '';
     return mimemail($from, $to, $subject, $body, NULL, $headers, NULL, array(), $mailkey);
   }
 }
 
-function mimemail_mail_alter($mailkey, &$recipient, &$subject, &$body, &$sender, &$headers) {
-
-  if (!variable_get('mimemail_alter', 0)) return;
-
-  // attempt to fixup non-html messages that are being sent through drupal_mail
-  // I'm open to suggestions for better ways of doing this
-  $body = check_markup($body, FILTER_FORMAT_DEFAULT);
-  return;
-}
-
 function mimemail_post() {
   $message = $_POST['message'];
   $token   = $_POST['token'];
@@ -378,6 +389,17 @@ function mimemail_address($address) {
 }
 
 /**
+ * Implementation of hook_theme().
+ */
+function mimemail_theme() {
+  return array(
+    'mimemail_message' => array(
+      'arguments' => array('body' => NULL, 'mailkey' => NULL)
+    )
+  );
+}
+
+/**
  * Themeable message body
  */
 function theme_mimemail_message($body, $mailkey = NULL) {
@@ -390,8 +412,9 @@ function theme_mimemail_message($body, $
 
   $output .= '<style type="text/css"><!--';
   if (!file_exists($styles)) {
-    // embed a version of all style definitions
-    $styles = preg_replace('|<style.*"'. base_path() .'([^"]*)".*|', '\1', drupal_get_css());
+    // Embed a version of all style definitions.
+    // Stip off the query-string suffix from css filename (see drupal_get_css()).
+    $styles = preg_replace('|<link.*"'. base_path() .'([^"?]*).*".*|', '\1', drupal_get_css());
   }
   foreach (explode("\n", $styles) as $style) {
     $output .= file_get_contents($style);
