### Eclipse Workspace Patch 1.0
#P CVS mimemail HEAD
Index: mimemail.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/mimemail.inc,v
retrieving revision 1.21
diff -u -r1.21 mimemail.inc
--- mimemail.inc	26 Feb 2007 23:57:43 -0000	1.21
+++ mimemail.inc	27 Mar 2007 21:26:52 -0000
@@ -1,5 +1,5 @@
 <?php
-/* $Id: mimemail.inc,v 1.21 2007/02/26 23:57:43 vauxia Exp $ */
+/* $Id: mimemail.inc,v 1.18.2.3 2007/02/26 23:58:44 vauxia Exp $ */
 
 /**
  * @file
@@ -322,6 +322,8 @@
  * @param $body An HTML message body
  * @param $subject The message subject
  * @param $plaintext Whether the recipient prefers plaintext-only messages (default false)
+ * @param $text Plain text message body
+ * @param @attachments array of attachments (default empty array)
  * 
  * @return
  *     an array containing the elements 'header' and 'body'.
@@ -338,10 +340,20 @@
     $text = mimemail_html_to_text($body);
   }
   if ($plaintext) {
-    return array(
-      'body' => $text, 
-      'headers' => array('Content-Type' => 'text/plain; charset=utf-8'),
-    );
+    //Plain mail without attachment
+    if (empty($attachments)) {
+      return array(
+        'body' => $text, 
+        'headers' => array('Content-Type' => 'text/plain; charset=utf-8'),
+      );
+    }
+    //Plain mail has attachement
+    else {
+      $parts = array(array(
+      'content' => $text, 
+        'Content-Type' => 'text/plain; charset=utf-8',
+      ));
+    }
   }
   $content_type = 'multipart/alternative';
 
Index: mimemail.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/mimemail.module,v
retrieving revision 1.16
diff -u -r1.16 mimemail.module
--- mimemail.module	26 Feb 2007 23:57:43 -0000	1.16
+++ mimemail.module	27 Mar 2007 21:26:53 -0000
@@ -1,4 +1,4 @@
-<?php /* $Id: mimemail.module,v 1.16 2007/02/26 23:57:43 vauxia Exp $ */
+<?php /* $Id: mimemail.module,v 1.14.2.2 2007/02/26 23:58:44 vauxia Exp $ */
 
 /**
  * @file Component module for sending Mime-encoded emails
@@ -132,6 +132,7 @@
  * @param $plaintext Whether to send message as plaintext only
  * @param $headers Optional e-mail headers in a keyed array
  * @param $text Optional plaintext portion of a multipart e-mail (instead of auto-generated)
+ * @param $attachments array of attachments
  * 
  * @return result from mail() call
  */
@@ -140,19 +141,19 @@
   require_once dirname(__FILE__).'/mimemail.inc';
   
   // try to determine recpient's text mail preference
-  if (!is_null($plaintext)) {
-    if (is_object($recipient) && isset($recipient->mimemail_textonly)) {
+  if (is_null($plaintext)) {
+    if (is_object($recipient)) {
       $plaintext = $recipient->mimemail_textonly;
     }
     elseif (valid_email_address($recipient)) {
-      if (is_object($r = user_load(array('mail'=>$recipient))) && isset($r->mimemail_textonly)) {
+      if (is_object($r = user_load(array('mail'=>$recipient)))) {
         $plaintext = $r->mimemail_textonly;
         $recipient = $r; // might as well pass the user object to the address function
       }
     }
   }
   $subject = mime_header_encode($subject);
-  
+
   $plaintext = $plaintext || variable_get('mimemail_textonly', 0);
   $sender    = mimemail_address($sender);
   $mail      = mimemail_html_body(theme('mimemail_message', $body), $subject, $plaintext, $text, $attachments);
