Class yii\symfonymailer\Mailer
| Inheritance | yii\symfonymailer\Mailer » yii\mail\BaseMailer |
|---|---|
| Source Code | https://github.com/yiisoft/yii2-symfonymailer/blob/master/src/Mailer.php |
PHPStan Types
| Name | Value |
|---|---|
| TransportConfigArray | array{scheme?: string, host?: string, username?: string, password?: string, port?: integer, options?: array, dsn?: string|\Symfony\Component\Mailer\Transport\Dsn} |
Psalm Types
| Name | Value |
|---|---|
| TransportHostArray | array{scheme?: string, host?: string, username?: string, password?: string, port?: integer, options?: array, dsn?: string|\Symfony\Component\Mailer\Transport\Dsn} |
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $encrypter | yii\symfonymailer\MessageEncrypterInterface|null | yii\symfonymailer\Mailer | |
| $messageClass | string | Message default class name. | yii\symfonymailer\Mailer |
| $signer | yii\symfonymailer\MessageSignerInterface|null | yii\symfonymailer\Mailer | |
| $signerOptions | array | yii\symfonymailer\Mailer | |
| $transportFactory | \Symfony\Component\Mailer\Transport|null | yii\symfonymailer\Mailer |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| setTransport() | yii\symfonymailer\Mailer |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| sendMessage() | yii\symfonymailer\Mailer |
Property Details
Message default class name.
Method Details
| protected sendMessage( yii\symfonymailer\MessageWrapperInterface&\yii\mail\MessageInterface $message ): boolean | ||
| $message | yii\symfonymailer\MessageWrapperInterface&\yii\mail\MessageInterface | |
| throws | \Symfony\Component\Mailer\Exception\TransportExceptionInterface | |
|---|---|---|
protected function sendMessage($message): bool
{
if (!($message instanceof MessageWrapperInterface)) {
throw new InvalidArgumentException(sprintf(
'The message must be an instance of "%s". The "%s" instance is received.',
MessageWrapperInterface::class,
get_class($message),
));
}
$message = $message->getSymfonyEmail();
if ($this->encrypter !== null) {
$message = $this->encrypter->encrypt($message);
}
if ($this->signer !== null) {
$message = $this->signer->sign($message, $this->signerOptions);
}
$this->getTransport()->send($message);
return true;
}
| public setTransport( TransportConfigArray|\Symfony\Component\Mailer\Transport\TransportInterface $transport ): void | ||
| $transport | TransportConfigArray|\Symfony\Component\Mailer\Transport\TransportInterface | |
| throws | \yii\base\InvalidConfigException |
on invalid argument. |
|---|---|---|
public function setTransport(array|TransportInterface $transport): void
{
$this->_transport = $transport instanceof TransportInterface ? $transport : $this->createTransport($transport);
}