Class yii\symfonymailer\Mailer
| Inheritance | yii\ |
|---|---|
| Source Code | https://github.com/yiisoft/yii2-symfonymailer/blob/master/src/Mailer.php |
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $encrypter | ?\ |
yii\ |
|
| $messageClass | string | Message default class name. | yii\ |
| $signer | ?\ |
yii\ |
|
| $signerOptions | array | yii\ |
|
| $transportFactory | ?\ |
yii\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| setTransport() | yii\ |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| sendMessage() | yii\ |
Property Details
Message default class name.
Method Details
| protected boolean sendMessage ( mixed $message ) | ||
| $message | mixed | |
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->getSymfonyMailer()->send($message);
return true;
}
| public void setTransport ( \ | ||
| $transport | \ |
|
| throws | \ |
on invalid argument. |
|---|---|---|
public function setTransport($transport): void
{
if (!is_array($transport) && !$transport instanceof TransportInterface) {
throw new InvalidArgumentException('"' . get_class($this) . '::transport" should be either object or array, "' . gettype($transport) . '" given.');
}
$this->_transport = $transport instanceof TransportInterface ? $transport : $this->createTransport($transport);
$this->symfonyMailer = null;
}