diff -up /Users/erik/project/xx/after_codestyle/mimemail.inc ./mimemail.inc
--- /Users/erik/project/xx/after_codestyle/mimemail.inc	2008-05-19 13:06:28.000000000 +0200
+++ ./mimemail.inc	2008-05-19 11:20:58.000000000 +0200
@@ -225,7 +225,7 @@ function mimemail_multipart_body($parts,
       $part_headers['Content-Disposition'] = 'inline';
     }
 
-    if ($part['Content-Transfer-Encoding']) {
+    if (!empty($part['Content-Transfer-Encoding'])) {
       $part_headers['Content-Transfer-Encoding'] = $part['Content-Transfer-Encoding'];
     }
 
@@ -256,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";
@@ -520,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));
 }
 
 /**
diff -up /Users/erik/project/xx/after_codestyle/mimemail.info ./mimemail.info
--- /Users/erik/project/xx/after_codestyle/mimemail.info	2008-05-19 13:06:06.000000000 +0200
+++ ./mimemail.info	2008-05-18 12:54:06.000000000 +0200
@@ -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
diff -up /Users/erik/project/xx/after_codestyle/mimemail.module ./mimemail.module
--- /Users/erik/project/xx/after_codestyle/mimemail.module	2008-05-19 13:06:28.000000000 +0200
+++ ./mimemail.module	2008-05-19 13:15:21.000000000 +0200
@@ -11,25 +11,23 @@
  * 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()
@@ -209,14 +207,15 @@ function mimemail_prepare($sender, $reci
  * 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 ? $plaintext
- * @param array $headers
- * @param ? $text
- * @param array $attachments
+ * @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 = '') {
@@ -304,19 +303,24 @@ 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 = $message['headers'];
+    $mailkey = $message['mailkey'];
     return mimemail($from, $to, $subject, $body, NULL, $headers, NULL, array(), $mailkey);
   }
 }
 
-function mimemail_mail_alter($mailkey, &$recipient, &$subject, &$body, &$sender, &$headers) {
+function mimemail_mail_alter(&$message) {
 
   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;
+  $message['body'] = is_array($message['body']) ? implode("\n\n", $message['body']) : $message['body'] ;
+  $message['body'] = check_markup($message['body'], FILTER_FORMAT_DEFAULT);
 }
 
 function mimemail_post() {
@@ -395,6 +399,18 @@ function mimemail_address($address) {
 }
 
 /**
+ * Implementation of hook_theme().
+ */
+function mimemail_theme() {
+  return array(
+    'mimemail_message' => array(
+      'arguments' => array('body' => NULL)
+    )
+  );
+}
+
+
+/**
  * Themeable message body
  */
 function theme_mimemail_message($body, $mailkey = NULL) {
@@ -407,8 +423,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);
