Final Class Yiisoft\Mailer\SwiftMailer\Mailer
| Inheritance | Yiisoft\ |
|---|
Mailer implements a mailer based on SwiftMailer.
See also https://swiftmailer.symfony.com.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| sendMessage() | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $messageFactory | \ |
|
| $messageBodyRenderer | \ |
|
| $eventDispatcher | \ |
|
| $transport | \ |
|
| $plugins | \ |
|
public function __construct(
MessageFactoryInterface $messageFactory,
MessageBodyRenderer $messageBodyRenderer,
EventDispatcherInterface $eventDispatcher,
Swift_Transport $transport,
array $plugins = []
) {
parent::__construct($messageFactory, $messageBodyRenderer, $eventDispatcher);
$this->swiftMailer = new Swift_Mailer($transport);
foreach ($plugins as $plugin) {
$this->swiftMailer->registerPlugin($plugin);
}
}
| protected void sendMessage ( \ | ||
| $message | \ |
|
protected function sendMessage(MessageInterface $message): void
{
/** @var Message $message */
$sent = $this->swiftMailer->send($message->getSwiftMessage());
if ($sent === 0) {
throw new RuntimeException('Unable send message.');
}
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.