/**
  * get and decode message body
  *
  * @param Expressomail_Model_Message $_message
  * @param string $_partId
  * @param string $_contentType
  * @param Expressomail_Model_Account $_account
  * @return string
  *
  * @todo multipart_related messages should deliver inline images
  */
 protected function _getAndDecodeMessageBody(Expressomail_Model_Message $_message, $_partId, $_contentType, $_account = NULL)
 {
     $structure = $_message->getPartStructure($_partId);
     $bodyParts = $_message->getBodyParts($structure, $_contentType);
     if (empty($bodyParts)) {
         return '';
     }
     $messageBody = '';
     foreach ($bodyParts as $partId => $partStructure) {
         if ($partStructure['disposition']['type'] == 'ATTACHMENT') {
             continue;
         }
         $bodyPart = $this->getMessagePart($_message, $partId, TRUE, $partStructure);
         $body = $this->_getDecodedBodyContent($bodyPart, $partStructure);
         if ($partStructure['contentType'] != Zend_Mime::TYPE_TEXT && $partStructure['contentType'] != Expressomail_Model_Message::CONTENT_TYPE_MESSAGE_RFC822) {
             $bodyCharCountBefore = strlen($body);
             $body = $this->_getDecodedBodyImages($_message->getId(), $body);
             $body = $this->_purifyBodyContent($body);
             $body = Expressomail_Message::linkify($body);
             $bodyCharCountAfter = strlen($body);
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Purifying removed ' . ($bodyCharCountBefore - $bodyCharCountAfter) . ' / ' . $bodyCharCountBefore . ' characters.');
             }
             if ($_message->text_partid && $bodyCharCountAfter < $bodyCharCountBefore / 10) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                     Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Purify may have removed (more than 9/10) too many chars, using alternative text message part.');
                 }
                 return $this->_getAndDecodeMessageBody($_message, $_message->text_partid, Zend_Mime::TYPE_TEXT, $_account);
             }
         } else {
             if ($partStructure['contentType'] === Expressomail_Model_Message::CONTENT_TYPE_MESSAGE_RFC822) {
                 $partContent = $this->_getPartContent($_message, $partId, $partStructure);
                 $translate = Tinebase_Translation::getTranslation('Expressomail');
                 $body .= "\n\n----- " . $translate->_('Returned Message Content') . " -----\n" . $partContent;
             }
             $body = '<pre class="message-viewer">' . $body . '</pre>';
         }
         if (!($_account !== NULL && $_account->display_format === Expressomail_Model_Account::DISPLAY_CONTENT_TYPE && $bodyPart->type == Zend_Mime::TYPE_TEXT)) {
             //$body = Expressomail_Message::convertContentType($partStructure['contentType'], $_contentType, $body);
             if ($bodyPart->type == Zend_Mime::TYPE_TEXT && $_contentType == Zend_Mime::TYPE_HTML) {
                 $body = Expressomail_Message::replaceUris($body);
                 //$body = Expressomail_Message::replaceEmails($body);
             }
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Do not convert ' . $bodyPart->type . ' part to ' . $_contentType);
             }
         }
         // Use only Expressomail to send e-mails
         $body = Expressomail_Message::replaceEmails($body);
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Adding part ' . $partId . ' to message body.');
         }
         $messageBody .= $body;
     }
     return $messageBody;
 }