/**
  * {@inheritdoc}
  */
 public function send(\Zend_Mail $mail)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'send');
     if (!$pluginInfo) {
         return parent::send($mail);
     } else {
         return $this->___callPlugins('send', func_get_args(), $pluginInfo);
     }
 }
Example #2
0
 public function sendMessage()
 {
     if (!$this->dataHelper->getUseTransactional()) {
         parent::send($this->_message);
     } else {
         try {
             $this->transactionalApi->sendMessage($this->_message);
         } catch (\Exception $e) {
             $this->logger->info("Failed to send message: " . $e->getMessage());
         }
     }
 }
Example #3
0
 /**
  * Send a mail using this transport
  *
  * @return void
  */
 public function sendMessage()
 {
     // If Mailgun Service is disabled, use the default mail transport
     if (!$this->config->enabled()) {
         parent::sendMessage();
         return;
     }
     $messageBuilder = $this->createMailgunMessage($this->parseMessage());
     $mailgun = new Mailgun($this->config->privateKey(), $this->getHttpClient(), $this->config->endpoint());
     $mailgun->setApiVersion($this->config->version());
     $mailgun->setSslEnabled($this->config->ssl());
     $mailgun->sendMessage($this->config->domain(), $messageBuilder->getMessage(), $messageBuilder->getFiles());
 }
 /**
  * Send a mail using this transport
  *
  * @return void
  * @throws \Magento\Framework\Exception\MailException
  */
 public function sendMessage()
 {
     if (!$this->_helper->canUse()) {
         parent::sendMessage();
         return;
     }
     try {
         $api = new \SUMOHeavy\Postmark\Model\Transport\Postmark($this->_helper->getApiKey());
         $api->send($this->_message);
     } catch (\Exception $e) {
         var_dump($e->getMessage());
         exit;
         throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e);
     }
 }
Example #5
0
 /**
  * @covers \Magento\Framework\Mail\Transport::sendMessage
  * @expectedException \Magento\Framework\Exception\MailException
  * @expectedExceptionMessage No body specified
  */
 public function testSendMessageBrokenMessage()
 {
     $this->_messageMock->expects($this->any())->method('getParts')->will($this->returnValue(['a', 'b']));
     $this->_transport->sendMessage();
 }