protected function generateBody()
    {
        $message = new Mime\Message();

        $text = $this->generateHtml();
        $textPart = new Mime\Part($text);
        $textPart->type = 'text/html';
        $textPart->charset = 'UTF-8';
        $textPart->disposition = Mime\Mime::DISPOSITION_INLINE;
        $message->addPart($textPart);

        if (is_object($this->application->getContact()->getImage()) &&
            $this->application->getContact()->getImage()->getId()) {
            /* @var $image \Auth\Entity\UserImage */
            $image = $this->application->getContact()->getImage();
            $part = new Mime\Part($image->getResource());
            $part->setType($image->getType());
            $part->setEncoding(Mime\Mime::ENCODING_BASE64);
            $part->setFileName($image->getName());
            $part->setDisposition(Mime\Mime::DISPOSITION_ATTACHMENT);
            $message->addPart($part);
        }
        
        foreach ($this->application->getAttachments() as $attachment) { /* @var \Applications\Entity\Attachment $attachment*/
            /* @var  \Applications\Entity\Attachment $part */
            $part = new Mime\Part($attachment->getResource());
            $part->setType($attachment->getType());
            $part->encoding = Mime\Mime::ENCODING_BASE64;
            $part->filename = $attachment->getName();
            $part->disposition = Mime\Mime::DISPOSITION_ATTACHMENT;
            $message->addPart($part);
        }
        
        $this->setBody($message);
    }