Index: includes/webform.submissions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/includes/webform.submissions.inc,v
retrieving revision 1.36
diff -u -r1.36 webform.submissions.inc
--- includes/webform.submissions.inc	17 Feb 2011 04:08:56 -0000	1.36
+++ includes/webform.submissions.inc	19 Feb 2011 23:09:35 -0000
@@ -199,6 +199,9 @@
   // Create a themed message for mailing.
   $send_count = 0;
   foreach ($emails as $eid => $email) {
+    // Set the HTML property based on availablity of MIME Mail.
+    $email['html'] = ($email['html'] && module_exists('mimemail'));
+
     // Pass through the theme layer if using the default template.
     if ($email['template'] == 'default') {
       $email['message'] = theme(array('webform_mail_' . $node->nid, 'webform_mail', 'webform_mail_message'), array('node' => $node, 'submission' => $submission, 'email' => $email));
@@ -208,7 +211,6 @@
     }
 
     // Replace tokens in the message.
-    $email['html'] = ($email['html'] && module_exists('mimemail'));
     $email['message'] = _webform_filter_values($email['message'], $node, $submission, $email, FALSE, TRUE);
 
     // Build the e-mail headers.
@@ -273,7 +275,7 @@
 
       $language = $user->uid ? user_preferred_language($user) : language_default();
       $mail_params = array(
-        'message' => $email['message'],
+        'body' => array($email['message']),
         'subject' => $email['subject'],
         'headers' => $email['headers'],
         'node' => $node,
@@ -296,18 +298,17 @@
           }
         }
 
-        // Send the e-mail via MIME mail.
-        $message = mimemail($email['from'], $address, $email['subject'], $email['message'], !$email['html'], $email['headers'], $email['html'] ? NULL : $email['message'], $attachments, 'webform');
-        if ($message) {
-          $send_count++;
-        }
+        // Process the e-mail with MIME mail, encoding attachments.
+        module_load_include('inc', 'mimemail');
+        $mimemail = mimemail_html_body($email['message'], $mail_params['subject'], !$email['html'], $email['html'] ? NULL : $email['message'], $attachments);
+        $mail_params['message'] = $mimemail['body'];
+        $mail_params['headers'] = array_merge($mail_params['headers'], $mimemail['headers']);
       }
-      else {
-        // Normal Drupal mailer.
-        $message = drupal_mail('webform', 'submission', $address, $language, $mail_params, $email['from']);
-        if ($message['result']) {
-          $send_count++;
-        }
+
+      // Mail the submission.
+      $message = drupal_mail('webform', 'submission', $address, $language, $mail_params, $email['from']);
+      if ($message['result']) {
+        $send_count++;
       }
     }
   }
Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.286
diff -u -r1.286 webform.module
--- webform.module	19 Feb 2011 00:04:49 -0000	1.286
+++ webform.module	19 Feb 2011 23:09:34 -0000
@@ -1480,7 +1480,6 @@
 function webform_mail($key, &$message, $params) {
   $message['headers'] = array_merge($message['headers'], $params['headers']);
   $message['subject'] = $params['subject'];
-  $message['body'][] = $params['message'];
 }
 
 /**
