Class yii\symfonymailer\Message

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

Public Methods

Hide inherited methods

Method Description Defined By
__clone() yii\symfonymailer\Message
__construct() yii\symfonymailer\Message
addHeader() yii\symfonymailer\Message
attach() yii\symfonymailer\Message
attachContent() yii\symfonymailer\Message
embed() yii\symfonymailer\Message
embedContent() yii\symfonymailer\Message
getBcc() yii\symfonymailer\Message
getCc() yii\symfonymailer\Message
getCharset() yii\symfonymailer\Message
getDate() yii\symfonymailer\Message
getFrom() yii\symfonymailer\Message
getHeader() yii\symfonymailer\Message
getHtmlBody() yii\symfonymailer\Message
getPriority() yii\symfonymailer\Message
getReplyTo() yii\symfonymailer\Message
getReturnPath() yii\symfonymailer\Message
getSender() yii\symfonymailer\Message
getSubject() yii\symfonymailer\Message
getSymfonyEmail() Returns a Symfony email instance. yii\symfonymailer\Message
getTextBody() yii\symfonymailer\Message
getTo() yii\symfonymailer\Message
setBcc() yii\symfonymailer\Message
setCc() yii\symfonymailer\Message
setCharset() yii\symfonymailer\Message
setDate() yii\symfonymailer\Message
setFrom() yii\symfonymailer\Message
setHeader() yii\symfonymailer\Message
setHeaders() yii\symfonymailer\Message
setHtmlBody() yii\symfonymailer\Message
setPriority() yii\symfonymailer\Message
setReplyTo() yii\symfonymailer\Message
setReturnPath() yii\symfonymailer\Message
setSender() yii\symfonymailer\Message
setSubject() yii\symfonymailer\Message
setTextBody() yii\symfonymailer\Message
setTo() yii\symfonymailer\Message
toString() yii\symfonymailer\Message

Method Details

Hide inherited methods

__clone() public method

public __clone( ): mixed

                public function __clone()
{
    $this->email = clone $this->email;
}

            
__construct() public method

public __construct( mixed $config = [] ): mixed
$config mixed

                public function __construct($config = [])
{
    $this->email = new Email();
    parent::__construct($config);        
}

            
addHeader() public method

public addHeader( mixed $name, mixed $value ): self
$name mixed
$value mixed

                public function addHeader($name, $value): self
{
    $this->email->getHeaders()->addTextHeader($name, $value);
    return $this;
}

            
attach() public method

public attach( mixed $fileName, array $options = [] ):
$fileName mixed
$options array

                public function attach($fileName, array $options = [])
{
    $file = [];
    if (!empty($options['fileName'])) {
        $file['name'] = $options['fileName'];
    } else {
        $file['name'] = $fileName;
    }
    if (!empty($options['contentType'])) {
        $file['contentType'] = $options['contentType'];
    } else {
        $file['contentType'] = mime_content_type($fileName);
    }
    $this->email->attachFromPath($fileName, $file['name'], $file['contentType']);
    return $this;
}

            
attachContent() public method

public attachContent( mixed $content, array $options = [] ):
$content mixed
$options array

                public function attachContent($content, array $options = [])
{
    $file = [];
    if (!empty($options['fileName'])) {
        $file['name'] = $options['fileName'];
    } else {
        $file['name'] = null;
    }
    if (!empty($options['contentType'])) {
        $file['contentType'] = $options['contentType'];
    } else {
        $file['contentType'] = null;
    }
    $this->email->attach($content, $file['name'], $file['contentType']);
    return $this;
}

            
embed() public method

public embed( mixed $fileName, array $options = [] ):
$fileName mixed
$options array

                public function embed($fileName, array $options = [])
{
    $file = [];
    if (!empty($options['fileName'])) {
        $file['name'] = $options['fileName'];
    } else {
        $file['name'] = $fileName;
    }
    if (!empty($options['contentType'])) {
        $file['contentType'] = $options['contentType'];
    } else {
        $file['contentType'] = mime_content_type($fileName);
    }
    $this->email->embedFromPath($fileName, $file['name'], $file['contentType']);
    return 'cid:' . $file['name'];
}

            
embedContent() public method

public embedContent( mixed $content, array $options = [] ):
$content mixed
$options array

                public function embedContent($content, array $options = [])
{
    $file = [];
    if (!empty($options['fileName'])) {
        $file['name'] = $options['fileName'];
    } else {
        $file['name'] = null;
    }
    if (!empty($options['contentType'])) {
        $file['contentType'] = $options['contentType'];
    } else {
        $file['contentType'] = null;
    }
    $this->email->embed($content, $file['name'], $file['contentType']);
    return 'cid:' . $file['name'];
}

            
getBcc() public method

public getBcc( ): mixed

                public function getBcc()
{
    return $this->convertAddressesToStrings($this->email->getBcc());
}

            
getCc() public method

public getCc( ): mixed

                public function getCc()
{
    return $this->convertAddressesToStrings($this->email->getCc());
}

            
getCharset() public method

public getCharset( ): string

                public function getCharset(): string
{
    return $this->charset;
}

            
getDate() public method

public getDate( ): DateTimeImmutable|null

                public function getDate(): ?DateTimeImmutable
{
    return $this->email->getDate();
}

            
getFrom() public method

public getFrom( ): mixed

                public function getFrom()
{
    return $this->convertAddressesToStrings($this->email->getFrom());
}

            
getHeader() public method

public getHeader( mixed $name ): array
$name mixed

                public function getHeader($name): array
{
    $headers = $this->email->getHeaders();
    if (!$headers->has($name)) {
        return [];
    }
    $values = [];
    /** @var HeaderInterface $header */
    foreach ($headers->all($name) as $header) {
        $values[] = $header->getBodyAsString();
    }
    return $values;
}

            
getHtmlBody() public method

public getHtmlBody( ): string

                public function getHtmlBody(): string
{
    return (string) $this->email->getHtmlBody();
}

            
getPriority() public method

public getPriority( ): integer

                public function getPriority(): int
{
    return $this->email->getPriority();
}

            
getReplyTo() public method

public getReplyTo( ): mixed

                public function getReplyTo()
{
    return $this->convertAddressesToStrings($this->email->getReplyTo());
}

            
getReturnPath() public method

public getReturnPath( ): string

                public function getReturnPath(): string
{
    $returnPath = $this->email->getReturnPath();
    return $returnPath === null ? '' : $returnPath->getAddress();
}

            
getSender() public method

public getSender( ): string

                public function getSender(): string
{
    $sender = $this->email->getSender();
    return $sender === null ? '' : $sender->getAddress();
}

            
getSubject() public method

public getSubject( ): string

                public function getSubject(): string
{
    return (string) $this->email->getSubject();
}

            
getSymfonyEmail() public method

Returns a Symfony email instance.

public getSymfonyEmail( ): \Symfony\Component\Mime\Email
return \Symfony\Component\Mime\Email

Symfony email instance.

                public function getSymfonyEmail(): Email
{
    return $this->email;
}

            
getTextBody() public method

public getTextBody( ): string

                public function getTextBody(): string
{
    return (string) $this->email->getTextBody();
}

            
getTo() public method

public getTo( ): mixed

                public function getTo()
{
    return $this->convertAddressesToStrings($this->email->getTo());
}

            
setBcc() public method

public setBcc( mixed $bcc ): self
$bcc mixed

                public function setBcc($bcc): self
{
    $this->email->bcc(...$this->convertStringsToAddresses($bcc));
    return $this;
}

            
setCc() public method

public setCc( mixed $cc ): self
$cc mixed

                public function setCc($cc): self
{
    $this->email->cc(...$this->convertStringsToAddresses($cc));
    return $this;
}

            
setCharset() public method

public setCharset( mixed $charset ): self
$charset mixed

                public function setCharset($charset): self
{
    $this->charset = $charset;
    return $this;
}

            
setDate() public method

public setDate( DateTimeInterface $date ): self
$date DateTimeInterface

                public function setDate(DateTimeInterface $date): self
{
    $this->email->date($date);
    return $this;
}

            
setFrom() public method

public setFrom( mixed $from ): self
$from mixed

                public function setFrom($from): self
{
    $this->email->from(...$this->convertStringsToAddresses($from));
    return $this;
}

            
setHeader() public method

public setHeader( mixed $name, mixed $value ): self
$name mixed
$value mixed

                public function setHeader($name, $value): self
{
    $headers = $this->email->getHeaders();
    if ($headers->has($name)) {
        $headers->remove($name);
    }
    foreach ((array) $value as $v) {
        $headers->addTextHeader($name, $v);
    }
    return $this;
}

            
setHeaders() public method

public setHeaders( mixed $headers ): self
$headers mixed

                public function setHeaders($headers): self
{
    foreach ($headers as $name => $value) {
        $this->setHeader($name, $value);
    }
    return $this;
}

            
setHtmlBody() public method

public setHtmlBody( mixed $html ): self
$html mixed

                public function setHtmlBody($html): self
{
    $this->email->html($html, $this->charset);
    return $this;
}

            
setPriority() public method

public setPriority( integer $priority ): self
$priority integer

                public function setPriority(int $priority): self
{
    $this->email->priority($priority);
    return $this;
}

            
setReplyTo() public method

public setReplyTo( mixed $replyTo ): self
$replyTo mixed

                public function setReplyTo($replyTo): self
{
    $this->email->replyTo(...$this->convertStringsToAddresses($replyTo));
    return $this;
}

            
setReturnPath() public method

public setReturnPath( string $address ): self
$address string

                public function setReturnPath(string $address): self
{
    $this->email->returnPath($address);
    return $this;
}

            
setSender() public method

public setSender( string $address ): self
$address string

                public function setSender(string $address): self
{
    $this->email->sender($address);
    return $this;
}

            
setSubject() public method

public setSubject( mixed $subject ): self
$subject mixed

                public function setSubject($subject): self
{
    $this->email->subject($subject);
    return $this;
}

            
setTextBody() public method

public setTextBody( mixed $text ): self
$text mixed

                public function setTextBody($text): self
{
    $this->email->text($text, $this->charset);
    return $this;
}

            
setTo() public method

public setTo( mixed $to ): self
$to mixed

                public function setTo($to): self
{
    $this->email->to(...$this->convertStringsToAddresses($to));
    return $this;
}

            
toString() public method

public toString( ): string

                public function toString(): string
{
    return $this->email->toString();
}