diff --git a/plugins/enigma/lib/enigma_signature.php b/plugins/enigma/lib/enigma_signature.php index 66933e2b6..9e6055ddb 100644 --- a/plugins/enigma/lib/enigma_signature.php +++ b/plugins/enigma/lib/enigma_signature.php @@ -55,7 +55,7 @@ class enigma_signature while (array_pop($level) !== null) { $parent = join('.', $level); - if ($parts[$parent] && $parts[$parent]->mimetype == 'message/rfc822') { + if (!empty($parts[$parent]) && $parts[$parent]->mimetype == 'message/rfc822') { $from = $parts[$parent]->headers['from']; $charset = $parts[$parent]->charset; break; diff --git a/program/include/rcmail_sendmail.php b/program/include/rcmail_sendmail.php index 54c1fa97c..967aa1b4d 100644 --- a/program/include/rcmail_sendmail.php +++ b/program/include/rcmail_sendmail.php @@ -678,14 +678,13 @@ class rcmail_sendmail $hash = md5($data) . '@' . $domain; $mime_type = $matches[2][$idx][0]; - $name = $list[$hash]; if (empty($mime_type)) { $mime_type = rcube_mime::image_content_type($data); } // add the image to the MIME message - if (!$name) { + if (empty($list[$hash])) { $ext = preg_replace('#^[^/]+/#', '', $mime_type); $name = substr($hash, 0, 8) . '.' . $ext; $list[$hash] = $name; @@ -693,6 +692,7 @@ class rcmail_sendmail $message->addHTMLImage($data, $mime_type, $name, false, $hash); } + $name = $list[$hash]; $body = substr_replace($body, $name, $m[1] + $offset, strlen($m[0])); $offset += strlen($name) - strlen($m[0]); }