Index: mimemail.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimemail/mimemail.inc,v
retrieving revision 1.44
diff -u -r1.44 mimemail.inc
--- mimemail.inc	21 Apr 2010 23:24:22 -0000	1.44
+++ mimemail.inc	24 Jun 2010 18:31:14 -0000
@@ -123,19 +123,26 @@
     if (strpos($url, '://') || preg_match('!mailto:!', $url)) {
       return $url;
     }
-    else {
     // The $url is a relative file path, continue processing.
-      $file = $url;
+    else {
+      // Download method is private, and the $url needs conversion.
+      if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && strpos($url, 'system/files/') !== FALSE) {
+        $file = file_create_path(drupal_substr($url, (strpos($url, 'system/files/') + drupal_strlen('system/files/'))));
+      }
+      // Download method is public.
+      else {
+        $file = $url;
+      }
     }
   }
 
-  if ($file && file_exists($file)) {
+  if ($file && @file_exists($file)) {
     // Prevent duplicate items
     if (isset($filenames[$file])) return 'cid:'. $filenames[$file];
-    
+
     $content_id = md5($file) .'@'. $_SERVER['HTTP_HOST'];
 
-    if (!$name) $name = substr($file, strrpos($file, '/') + 1);
+    if (!$name) $name = drupal_substr($file, strrpos($file, '/') + 1);
 
     $new_file = array(
       'name' => $name,
@@ -143,6 +150,7 @@
       'Content-ID' => $content_id,
       'Content-Disposition' => $disposition,
     );
+
     $new_file['Content-Type'] = file_get_mimetype($file);
 
     $files[] = $new_file;
@@ -150,6 +158,9 @@
 
     return 'cid:'. $content_id;
   }
+  else {
+    return $url;
+  }
 
   $ret = $files;
   $files = array();
