Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Transport.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Framework\Mail;
7 
10 use Zend\Mail\Message as ZendMessage;
11 use Zend\Mail\Transport\Sendmail;
12 
14 {
18  private $zendTransport;
19 
23  private $message;
24 
29  public function __construct(MessageInterface $message, $parameters = null)
30  {
31  $this->zendTransport = new Sendmail($parameters);
32  $this->message = $message;
33  }
34 
38  public function sendMessage()
39  {
40  try {
41  $this->zendTransport->send(
42  ZendMessage::fromString($this->message->getRawMessage())
43  );
44  } catch (\Exception $e) {
45  throw new MailException(new Phrase($e->getMessage()), $e);
46  }
47  }
48 
52  public function getMessage()
53  {
54  return $this->message;
55  }
56 }
$message
__construct(MessageInterface $message, $parameters=null)
Definition: Transport.php:29