Class yii\symfonymailer\Mailer

Inheritanceyii\symfonymailer\Mailer » yii\mail\BaseMailer
Source Code https://github.com/yiisoft/yii2-symfonymailer/blob/master/src/Mailer.php

Public Methods

Hide inherited methods

Method Description Defined By
setTransport() yii\symfonymailer\Mailer

Protected Methods

Hide inherited methods

Method Description Defined By
sendMessage() yii\symfonymailer\Mailer

Property Details

Hide inherited properties

$encrypter public property
public $encrypter null
$messageClass public property

Message default class name.

public string $messageClass = \yii\symfonymailer\Message::class
$signer public property
public $signer null
$signerOptions public property
public $signerOptions = []
$transportFactory public property
public $transportFactory null

Method Details

Hide inherited methods

sendMessage() protected method

protected void sendMessage ( $message )
$message

                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;
}

            
setTransport() public method

public void setTransport ( $transport )
$transport \yii\symfonymailer\PsalmTransportConfig|\Symfony\Component\Mailer\Transport\TransportInterface
throws \yii\base\InvalidConfigException

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;
}