Index: mimemail.inc
===================================================================
RCS file: /cvs/drupal/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	16 May 2010 15:20:34 -0000
@@ -123,32 +123,45 @@
     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_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)) {
-    // 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 ($file) {
+    if (@file_exists($file)) {
+      // Prevent duplicate items
+      if (isset($filenames[$file])) return 'cid:'. $filenames[$file];
+
+      $content_id = md5($file) .'@'. $_SERVER['HTTP_HOST'];
+
+      if (!$name) $name = drupal_substr($file, strrpos($file, '/') + 1);
+
+      $new_file = array(
+        'name' => $name,
+        'file' => $file,
+        'Content-ID' => $content_id,
+        'Content-Disposition' => $disposition,
+      );
 
-    $new_file = array(
-      'name' => $name,
-      'file' => $file,
-      'Content-ID' => $content_id,
-      'Content-Disposition' => $disposition,
-    );
-    $new_file['Content-Type'] = file_get_mimetype($file);
+      $new_file['Content-Type'] = file_get_mimetype($file);
 
-    $files[] = $new_file;
-    $filenames[$file] = $content_id;
+      $files[] = $new_file;
+      $filenames[$file] = $content_id;
 
-    return 'cid:'. $content_id;
+      return 'cid:'. $content_id;
+    }
+    else {
+      return $url;
+    }
   }
 
   $ret = $files;
