diff --git a/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php b/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php
index 1e12235..509ffb4 100644
--- a/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php
+++ b/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php
@@ -19,16 +19,22 @@ class MailhandlerCommandsFiles extends MailhandlerCommands {
       // 'unnamed_attachment' files are not really attachments, but mimeparts like HTML or Plain Text.
       // We only want to save real attachments, like images and files.
       if ($attachment->filename !== 'unnamed_attachment') {
-        $destination = 'public://mailhandler_temp/';
-        file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
         $filename = mb_decode_mimeheader($attachment->filename);
-        $file = file_save_data($attachment->data, $destination . $filename);
-        $file->status = 0;
-        drupal_write_record('file_managed', $file, 'fid');
-        if (!empty($attachment->id)) {
+      	if (!empty($attachment->id)) {
+        	$destination = 'public://mailhandler/';
+        	file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
+        	$file = file_save_data($attachment->data, $destination . $filename);
           $cid = trim($attachment->id, '<>');
           $uri = 'cid:' . $cid;
-          $message['body_html'] = str_replace($uri, $file->uri, $message['body_html']);
+          $destination = '/' . variable_get('file_public_path', conf_path() . '/files');
+          $file_uri = str_replace('public:/', $destination, $file->uri);
+          $message['body_html'] = str_replace($uri, $file_uri, $message['body_html']);
+        } else {
+        	$destination = 'public://mailhandler_temp/';
+        	file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
+        	$file = file_save_data($attachment->data, $destination . $filename);
+        	$file->status = 0;
+        	drupal_write_record('file_managed', $file, 'fid');
         }
         $message['attachments'][] = new FeedsEnclosure($file->uri, $attachment->filemime);
       }
