Class yii\symfonymailer\Message
Inheritance | yii\symfonymailer\Message » yii\mail\BaseMessage |
---|---|
Implements | yii\symfonymailer\MessageWrapperInterface |
Source Code | https://github.com/yiisoft/yii2-symfonymailer/blob/master/src/Message.php |
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$bcc | \yii\symfonymailer\PsalmAddressList | The type defined by the message interface is not strict enough. | yii\symfonymailer\Message |
$symfonyEmail | \Symfony\Component\Mime\Email | Symfony email instance. | yii\symfonymailer\Message |
Public Methods
Property Details
The type defined by the message interface is not strict enough.
Symfony email instance.
Method Details
public void __construct ( array $config = [] ) | ||
$config | array |
public function __construct(array $config = [])
{
$this->email = new Email();
parent::__construct($config);
}
public void addHeader ( string $name, string $value ) | ||
$name | ||
$value |
public function addHeader(string $name, string $value): self
{
$this->email->getHeaders()->addTextHeader($name, $value);
return $this;
}
public $this attach ( $fileName, array $options = [] ) | ||
$fileName | string | |
$options | \yii\symfonymailer\PsalmFileOptions |
public function attach($fileName, array $options = []): self
{
$this->email->attachFromPath(
$fileName,
$options['fileName'] ?? $fileName,
$options['contentType'] ?? FileHelper::getMimeType($fileName)
);
return $this;
}
public $this attachContent ( $content, array $options = [] ) | ||
$content | resource|string | |
$options | \yii\symfonymailer\PsalmFileOptions |
public function attachContent($content, array $options = []): self
{
$this->email->attach($content, $options['fileName'] ?? null, $options['contentType'] ?? null);
return $this;
}
public void embed ( $fileName, array $options = [] ) | ||
$fileName | string | |
$options | \yii\symfonymailer\PsalmFileOptions |
public function embed($fileName, array $options = []): string
{
$name = $options['fileName'] ?? $fileName;
$this->email->embedFromPath(
$fileName,
$name,
$options['contentType'] ?? FileHelper::getMimeType($fileName)
);
return 'cid:' . $name;
}
public void embedContent ( $content, array $options = [] ) | ||
$content | resource|string | |
$options | \yii\symfonymailer\PsalmFileOptions |
public function embedContent($content, array $options = []): string
{
if (!isset($options['fileName'])) {
throw new InvalidConfigException('A valid file name must be passed when embedding content');
}
$this->email->embed($content, $options['fileName'], $options['contentType'] ?? null);
return 'cid:' . $options['fileName'];
}
public array |
public function getBcc(): array|string
{
return $this->convertAddressesToStrings($this->email->getBcc());
}
public array |
public function getCc(): array|string
{
return $this->convertAddressesToStrings($this->email->getCc());
}
public void getDate ( ) |
public function getDate(): ?DateTimeImmutable
{
return $this->email->getDate();
}
public array |
public function getFrom(): array|string
{
return $this->convertAddressesToStrings($this->email->getFrom());
}
public list | ||
$name |
public function getHeader(string $name): array
{
$headers = $this->email->getHeaders();
$values = [];
/** @var HeaderInterface $header */
foreach ($headers->all($name) as $header) {
$values[] = $header->getBodyAsString();
}
return $values;
}
public void getPriority ( ) |
public function getPriority(): int
{
return $this->email->getPriority();
}
public array |
public function getReplyTo()
{
return $this->convertAddressesToStrings($this->email->getReplyTo());
}
public void getReturnPath ( ) |
public function getReturnPath(): string
{
$returnPath = $this->email->getReturnPath();
return $returnPath === null ? '' : $returnPath->getAddress();
}
public void getSender ( ) |
public function getSender(): string
{
$sender = $this->email->getSender();
return $sender === null ? '' : $sender->getAddress();
}
public void getSubject ( ) |
public function getSubject(): string
{
return (string) $this->email->getSubject();
}
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;
}
public array |
public function getTo(): array|string
{
return $this->convertAddressesToStrings($this->email->getTo());
}
public $this setBcc ( $bcc ) | ||
$bcc | \yii\symfonymailer\PsalmAddressList |
The type defined by the message interface is not strict enough |
public function setBcc($bcc): self
{
$this->email->bcc(...$this->convertStringsToAddresses($bcc));
return $this;
}
public $this setCc ( $cc ) | ||
$cc | \yii\symfonymailer\PsalmAddressList |
public function setCc($cc): self
{
$this->email->cc(...$this->convertStringsToAddresses($cc));
return $this;
}
public void setCharset ( $charset ) | ||
$charset |
public function setCharset($charset): self
{
$this->charset = $charset;
return $this;
}
public void setDate ( DateTimeInterface $date ) | ||
$date |
public function setDate(DateTimeInterface $date): self
{
$this->email->date($date);
return $this;
}
public $this setFrom ( $from ) | ||
$from | array |
public function setFrom($from): static
{
$this->email->from(...$this->convertStringsToAddresses($from));
return $this;
}
public void setHeader ( string $name, array|string $value ) | ||
$name | ||
$value | list |
public function setHeader(string $name, array|string $value): self
{
$headers = $this->email->getHeaders();
$headers->remove($name);
foreach ((array) $value as $v) {
$headers->addTextHeader($name, $v);
}
return $this;
}
public $this setHeaders ( array $headers ) | ||
$headers | array |
public function setHeaders(array $headers): self
{
foreach ($headers as $name => $value) {
$this->setHeader($name, $value);
}
return $this;
}
public void setHtmlBody ( $html ) | ||
$html |
public function setHtmlBody($html): self
{
$this->email->html($html, $this->charset);
return $this;
}
public void setPriority ( integer $priority ) | ||
$priority |
public function setPriority(int $priority): self
{
$this->email->priority($priority);
return $this;
}
public $this setReplyTo ( $replyTo ) | ||
$replyTo | \yii\symfonymailer\PsalmAddressList |
public function setReplyTo($replyTo): self
{
$this->email->replyTo(...$this->convertStringsToAddresses($replyTo));
return $this;
}
public void setReturnPath ( string $address ) | ||
$address |
public function setReturnPath(string $address): self
{
$this->email->returnPath($address);
return $this;
}
public void setSender ( string $address ) | ||
$address |
public function setSender(string $address): self
{
$this->email->sender($address);
return $this;
}
public void setSubject ( $subject ) | ||
$subject |
public function setSubject($subject): self
{
$this->email->subject($subject);
return $this;
}
public void setTextBody ( $text ) | ||
$text |
public function setTextBody($text): self
{
$this->email->text($text, $this->charset);
return $this;
}
public $this setTo ( $to ) | ||
$to | \yii\symfonymailer\PsalmAddressList |
public function setTo($to): self
{
$this->email->to(...$this->convertStringsToAddresses($to));
return $this;
}