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 void __clone ( )

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

            
__construct() public method

public void __construct ( $config = [] )
$config

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

            
addHeader() public method

public void addHeader ( $name, $value )
$name
$value

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

            
attach() public method

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

                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 void attachContent ( $content, array $options = [] )
$content
$options

                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 void embed ( $fileName, array $options = [] )
$fileName
$options

                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 void embedContent ( $content, array $options = [] )
$content
$options

                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 void getBcc ( )

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

            
getCc() public method

public void getCc ( )

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

            
getCharset() public method

public void getCharset ( )

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

            
getDate() public method

public void getDate ( )

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

            
getFrom() public method

public void getFrom ( )

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

            
getHeader() public method

public void getHeader ( $name )
$name

                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 void getHtmlBody ( )

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

            
getPriority() public method

public void getPriority ( )

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

            
getReplyTo() public method

public void getReplyTo ( )

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

            
getReturnPath() public method

public void getReturnPath ( )

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

            
getSender() public method

public void getSender ( )

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

            
getSubject() public method

public void getSubject ( )

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

            
getSymfonyEmail() public method

Returns a Symfony email instance.

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

Symfony email instance.

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

            
getTextBody() public method

public void getTextBody ( )

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

            
getTo() public method

public void getTo ( )

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

            
setBcc() public method

public void setBcc ( $bcc )
$bcc

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

            
setCc() public method

public void setCc ( $cc )
$cc

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

            
setCharset() public method

public void setCharset ( $charset )
$charset

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

            
setDate() public method

public void setDate ( DateTimeInterface $date )
$date

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

            
setFrom() public method

public void setFrom ( $from )
$from

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

            
setHeader() public method

public void setHeader ( $name, $value )
$name
$value

                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 void setHeaders ( $headers )
$headers

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

            
setHtmlBody() public method

public void setHtmlBody ( $html )
$html

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

            
setPriority() public method

public void setPriority ( integer $priority )
$priority

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

            
setReplyTo() public method

public void setReplyTo ( $replyTo )
$replyTo

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

            
setReturnPath() public method

public void setReturnPath ( string $address )
$address

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

            
setSender() public method

public void setSender ( string $address )
$address

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

            
setSubject() public method

public void setSubject ( $subject )
$subject

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

            
setTextBody() public method

public void setTextBody ( $text )
$text

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

            
setTo() public method

public void setTo ( $to )
$to

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

            
toString() public method

public void toString ( )

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