/**
  * @inheritdoc
  */
 public function createListFrom(\Conjoon\Mail\Message\RawMessage $message)
 {
     $attachments = array();
     try {
         /**
          * @see \Conjoon\Text\Parser\Mail\MessageContentParser
          */
         require_once 'Conjoon/Text/Parser/Mail/MessageContentParser.php';
         $parser = new \Conjoon\Text\Parser\Mail\MessageContentParser();
         $body = $parser->parse($message->getHeader() . "\n\n" . $message->getBody());
         $att =& $body['attachments'];
         for ($i = 0, $len = count($att); $i < $len; $i++) {
             $attachments[] = $this->createFrom($att[$i]);
         }
         return $attachments;
     } catch (\Exception $e) {
         throw new MailEntityCreatorException("Exception thrown by previous exception: " . $e->getMessage(), 0, $e);
     }
 }
 /**
  * inheritdoc
  */
 public function createFrom(\Conjoon\Mail\Message\RawMessage $message)
 {
     $header = $this->parseHeader($message->getHeader());
     $body = $this->parseBody($message->getHeader() . "\n\n" . $message->getBody());
     $message = new \Conjoon\Data\Entity\Mail\ImapMessageEntity();
     $message->setMessageId($header['messageId']);
     $message->setDate($header['date']);
     $message->setSubject($header['subject']);
     $message->setTo($header['to']);
     $message->setCc($header['cc']);
     $message->setBcc($header['bcc']);
     $message->setFrom($header['from']);
     $message->setReplyTo($header['replyTo']);
     $message->setInReplyTo($header['inReplyTo']);
     $message->setReferences($header['references']);
     $this->createAttachments($message, $body);
     $message->setContentTextPlain($body['contentTextPlain']);
     $message->setContentTextHtml($body['contentTextHtml']);
     return $message;
 }