diff --git a/basic_webmail.module b/basic_webmail.module
index 30276ee..9ff0a86 100644
--- a/basic_webmail.module
+++ b/basic_webmail.module
@@ -1248,6 +1248,8 @@ function _basic_webmail_message($message_number, $folder = 'INBOX') {
   $message_self_link = '';
   $attachment_links  = '';
   $reply_part        = '';
+  $attachment_patterns     = array();
+  $attachment_replacements = array();
 
   // Iterate over the parts list.
   foreach ($parts_list as $part_id => $part_array) {
@@ -1305,9 +1307,14 @@ function _basic_webmail_message($message_number, $folder = 'INBOX') {
     elseif ($part_array[0] && $part_array[1]) {
       $attachment        = _basic_webmail_process_attachment($imap_resource, $message_number, $part_id, $part_array[1]);
       $attachment_links .= l($attachment[1], $attachment[2]) . '&nbsp; -- &nbsp;';
+      $attachment_patterns[] = 'cid:' . $attachment[3];
+      $attachment_replacements[] = base_path() . $attachment[0];
     }
   }
 
+  if (!empty($attachment_patterns) && !empty($attachment_replacements)) {
+    $message_body = str_replace($attachment_patterns, $attachment_replacements, $message_body);
+  }
 
  // Add the formatted message body to the output string.
   $output .= $message_body;
@@ -3223,7 +3230,8 @@ function _basic_webmail_process_attachment($imap_resource, $message_number, $par
 
   $file_path  = file_save_data($file_data, $file_dest . '/' . $file_name, FILE_EXISTS_REPLACE);
   $file_url   = file_create_url($file_path);
-  $attachment = array($file_path, $file_name, $file_url);
+  $attachment_id = trim($part_structure->id, '<>');
+  $attachment = array($file_path, $file_name, $file_url, $attachment_id);
 
   return $attachment;
 }  //  End of _basic_webmail_process_attachment().
