diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index dedfba84c028c19a8f1bbe62a091e0ab337bffff..644d866637383fb9faadfce643616a280e8e2d52 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -19,7 +19,6 @@ require_once(INCLUDE_DIR.'class.ticket.php');
 require_once(INCLUDE_DIR.'class.dept.php');
 require_once(INCLUDE_DIR.'class.email.php');
 require_once(INCLUDE_DIR.'class.filter.php');
-require_once(INCLUDE_DIR.'html2text.php');
 require_once(INCLUDE_DIR.'tnef_decoder.php');
 
 class MailFetcher {
@@ -441,7 +440,8 @@ class MailFetcher {
                         array('attachment', 'inline'))) {
                 $filename = $this->findFilename($part->dparameters);
             }
-            // Inline attachments without disposition.
+            // Inline attachments without disposition. NOTE that elseif is
+            // not utilized here b/c ::findFilename may return null
             if (!$filename && $part->ifparameters && $part->parameters
                     && $part->type > 0) {
                 $filename = $this->findFilename($part->parameters);
@@ -450,6 +450,13 @@ class MailFetcher {
             $content_id = ($part->ifid)
                 ? rtrim(ltrim($part->id, '<'), '>') : false;
 
+            // Some mail clients / servers (like Lotus Notes / Domino) will
+            // send images without a filename. For such a case, generate a
+            // random filename for the image
+            if (!$filename && $content_id && $part->type == 5) {
+                $filename = 'image-'.Misc::randCode(4).'.'.strtolower($part->subtype);
+            }
+
             if($filename) {
                 return array(
                         array(
diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index 654e0e05ed66d7a8bca9af76d3e9e3db9ba601dc..f3feaf25d5e2678a4be426ab36e898dcd48782a2 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -367,10 +367,19 @@ class Mail_Parse {
             // Support attachments that do not specify a content-disposition
             // but do specify a "name" parameter in the content-type header.
             elseif (isset($part->ctype_parameters['name']))
-                $filename=$part->ctype_parameters['name'];
+                $filename = $part->ctype_parameters['name'];
             elseif (isset($part->ctype_parameters['name*']))
                 $filename = Format::decodeRfc5987(
                     $part->ctype_parameters['name*']);
+
+            // Some mail clients / servers (like Lotus Notes / Domino) will
+            // send images without a filename. For such a case, generate a
+            // random filename for the image
+            elseif (isset($part->headers['content-id'])
+                    && $part->headers['content-id']
+                    && 0 === strcasecmp($part->ctype_primary, 'image'))
+                $filename = 'image-'.Misc::randCode(4).'.'
+                    .strtolower($part->ctype_secondary);
             else
                 // Not an attachment?
                 return false;
diff --git a/include/class.thread.php b/include/class.thread.php
index fbe50bc87cdfaf94447b1167837041d65aa53574..fb180a767b027fa12ee99cfe71e8f441cb2cc92a 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1047,7 +1047,7 @@ Class ThreadEntry {
                 // content-id will be discarded, only the unique hash-code
                 // will be available to retrieve the image later
                 if ($a['cid'] && $a['key']) {
-                    $body = str_replace('src="cid:'.$a['cid'].'"',
+                    $body = preg_replace('/src=("|\'|\b)cid:'.$a['cid'].'\1/i',
                         'src="cid:'.$a['key'].'"', $body);
                 }
             }