/**
  * @inheritDoc
  */
 public static function fromWrappedMessage(MailWrappedMessage $wrappedMessage = null, $transport = null)
 {
     if (!$wrappedMessage instanceof MailWrappedMessage) {
         throw new MailWrapperSetupException('Not MailWrappedMessage');
     }
     if (!$transport instanceof MailgunManager) {
         throw new MailWrapperSetupException('Invalid Transport');
     }
     $message = $transport->batch();
     foreach ($wrappedMessage->getToRecipients() as $address) {
         $message->addToRecipient($address);
     }
     foreach ($wrappedMessage->getCcRecipients() as $address) {
         $message->addCcRecipient($address);
     }
     foreach ($wrappedMessage->getBccRecipients() as $address) {
         $message->addBccRecipient($address);
     }
     $message->setFromAddress($wrappedMessage->getFrom());
     $message->setReplyToAddress($wrappedMessage->getReplyTo());
     $message->setSubject($wrappedMessage->getSubject());
     if ($wrappedMessage->getContentText()) {
         $message->setTextBody($wrappedMessage->getContentText());
     }
     if ($wrappedMessage->getContentHtml()) {
         $message->setHtmlBody($wrappedMessage->getContentHtml());
     }
     return $message;
 }
 /**
  * @inheritDoc
  */
 public static function fromWrappedMessage(MailWrappedMessage $wrappedMessage = null, $transport = null)
 {
     if (!$wrappedMessage instanceof MailWrappedMessage) {
         throw new MailWrapperSetupException('Not MailWrappedMessage');
     }
     $message = new Message();
     foreach ($wrappedMessage->getToRecipients() as $address) {
         $message->addTo($address);
     }
     foreach ($wrappedMessage->getCcRecipients() as $address) {
         $message->addCc($address);
     }
     foreach ($wrappedMessage->getBccRecipients() as $address) {
         $message->addBcc($address);
     }
     $message->setReplyTo($wrappedMessage->getReplyTo());
     $message->setFrom($wrappedMessage->getFrom());
     $message->setSubject($wrappedMessage->getSubject());
     if ($wrappedMessage->getContentText()) {
         $message->setBody($wrappedMessage->getContentText());
     }
     if ($wrappedMessage->getContentHtml()) {
         $html = new MimePart($wrappedMessage->getContentHtml());
         $html->type = "text/html";
         $message->setBody($body);
     }
     return $message;
 }