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 |
Psalm Types
| Name | Value |
|---|---|
| PsalmFileOptions | array{fileName?: string, contentType?: string} |
| PsalmAddressList | array<integer|string, string>|string |
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $bcc | 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 __construct( array $config = [] ): mixed | ||
| $config | array | |
public function __construct(array $config = [])
{
$this->email = new Email();
parent::__construct($config);
}
| public addHeader( string $name, string $value ): self | ||
| $name | string | |
| $value | string | |
public function addHeader(string $name, string $value): self
{
$this->email->getHeaders()->addTextHeader($name, $value);
return $this;
}
| public attach( string $fileName, PsalmFileOptions $options = [] ): $this | ||
| $fileName | string | |
| $options | PsalmFileOptions | |
public function attach($fileName, array $options = []): self
{
$this->email->attachFromPath(
$fileName,
$options['fileName'] ?? $fileName,
$options['contentType'] ?? FileHelper::getMimeType($fileName)
);
return $this;
}
| public attachContent( resource|string $content, PsalmFileOptions $options = [] ): $this | ||
| $content | resource|string | |
| $options | PsalmFileOptions | |
public function attachContent($content, array $options = []): self
{
$this->email->attach($content, $options['fileName'] ?? null, $options['contentType'] ?? null);
return $this;
}
| public embed( string $fileName, PsalmFileOptions $options = [] ): string | ||
| $fileName | string | |
| $options | 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 embedContent( resource|string $content, PsalmFileOptions $options = [] ): string | ||
| $content | resource|string | |
| $options | PsalmFileOptions | |
public function embedContent($content, array $options = []): string
{
if (empty($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 getBcc( ): mixed |
public function getBcc()
{
return $this->convertAddressesToStrings($this->email->getBcc());
}
| public getCc( ): mixed |
public function getCc()
{
return $this->convertAddressesToStrings($this->email->getCc());
}
| public getDate( ): DateTimeImmutable|null |
public function getDate(): ?DateTimeImmutable
{
return $this->email->getDate();
}
| public getFrom( ): mixed |
public function getFrom()
{
return $this->convertAddressesToStrings($this->email->getFrom());
}
| public getHeader( string $name ): array | ||
| $name | string | |
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 getPriority( ): integer |
public function getPriority(): int
{
return $this->email->getPriority();
}
| public getReplyTo( ): mixed |
public function getReplyTo()
{
return $this->convertAddressesToStrings($this->email->getReplyTo());
}
| public getReturnPath( ): string |
public function getReturnPath(): string
{
$returnPath = $this->email->getReturnPath();
return $returnPath === null ? '' : $returnPath->getAddress();
}
| public getSender( ): string |
public function getSender(): string
{
$sender = $this->email->getSender();
return $sender === null ? '' : $sender->getAddress();
}
| public getSubject( ): string |
public function getSubject(): string
{
return (string) $this->email->getSubject();
}
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;
}
| public getTo( ): mixed |
public function getTo()
{
return $this->convertAddressesToStrings($this->email->getTo());
}
| public setBcc( PsalmAddressList $bcc ): $this | ||
| $bcc | 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 setCc( PsalmAddressList $cc ): $this | ||
| $cc | PsalmAddressList | |
public function setCc($cc): self
{
$this->email->cc(...$this->convertStringsToAddresses($cc));
return $this;
}
| public setCharset( mixed $charset ): self | ||
| $charset | mixed | |
public function setCharset($charset): self
{
$this->charset = $charset;
return $this;
}
| public setDate( DateTimeInterface $date ): self | ||
| $date | DateTimeInterface | |
public function setDate(DateTimeInterface $date): self
{
$this->email->date($date);
return $this;
}
| public setFrom( array<integer|string, string>|string $from ): self | ||
| $from | array<integer|string, string>|string | |
public function setFrom($from): self
{
$this->email->from(...$this->convertStringsToAddresses($from));
return $this;
}
| public setHeader( string $name, string|list<string> $value ): self | ||
| $name | string | |
| $value | string|list<string> | |
public function setHeader(string $name, $value): self
{
$headers = $this->email->getHeaders();
$headers->remove($name);
foreach ((array) $value as $v) {
$headers->addTextHeader($name, $v);
}
return $this;
}
| public setHeaders( array<string, string|list<string>> $headers ): $this | ||
| $headers | array<string, string|list<string>> | |
public function setHeaders(array $headers): self
{
foreach ($headers as $name => $value) {
$this->setHeader($name, $value);
}
return $this;
}
| public setHtmlBody( mixed $html ): self | ||
| $html | mixed | |
public function setHtmlBody($html): self
{
$this->email->html($html, $this->charset);
return $this;
}
| public setPriority( integer $priority ): self | ||
| $priority | integer | |
public function setPriority(int $priority): self
{
$this->email->priority($priority);
return $this;
}
| public setReplyTo( PsalmAddressList $replyTo ): $this | ||
| $replyTo | PsalmAddressList | |
public function setReplyTo($replyTo): self
{
$this->email->replyTo(...$this->convertStringsToAddresses($replyTo));
return $this;
}
| public setReturnPath( string $address ): self | ||
| $address | string | |
public function setReturnPath(string $address): self
{
$this->email->returnPath($address);
return $this;
}
| public setSender( string $address ): self | ||
| $address | string | |
public function setSender(string $address): self
{
$this->email->sender($address);
return $this;
}
| public setSubject( mixed $subject ): self | ||
| $subject | mixed | |
public function setSubject($subject): self
{
$this->email->subject($subject);
return $this;
}
| public setTextBody( mixed $text ): self | ||
| $text | mixed | |
public function setTextBody($text): self
{
$this->email->text($text, $this->charset);
return $this;
}
| public setTo( PsalmAddressList $to ): $this | ||
| $to | PsalmAddressList | |
public function setTo($to): self
{
$this->email->to(...$this->convertStringsToAddresses($to));
return $this;
}