Class yii\symfonymailer\Message
| Inheritance | yii\symfonymailer\Message » yii\mail\BaseMessage |
|---|---|
| Source Code | https://github.com/yiisoft/yii2-symfonymailer/blob/master/src/Message.php |
Public Methods
Method Details
| public __construct( mixed $config = [] ): mixed | ||
| $config | mixed | |
public function __construct($config = [])
{
$this->email = new Email();
parent::__construct($config);
}
| 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;
}
| 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;
}
| 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;
}
| 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'];
}
| 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'];
}
| 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( 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;
}
| public getHtmlBody( ): string |
public function getHtmlBody(): string
{
return (string) $this->email->getHtmlBody();
}
| 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 getTextBody( ): string |
public function getTextBody(): string
{
return (string) $this->email->getTextBody();
}
| public getTo( ): mixed |
public function getTo()
{
return $this->convertAddressesToStrings($this->email->getTo());
}
| public setBcc( mixed $bcc ): self | ||
| $bcc | mixed | |
public function setBcc($bcc): self
{
$this->email->bcc(...$this->convertStringsToAddresses($bcc));
return $this;
}
| public setCc( mixed $cc ): self | ||
| $cc | mixed | |
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( mixed $from ): self | ||
| $from | mixed | |
public function setFrom($from): self
{
$this->email->from(...$this->convertStringsToAddresses($from));
return $this;
}
| 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;
}
| public setHeaders( mixed $headers ): self | ||
| $headers | mixed | |
public function setHeaders($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( mixed $replyTo ): self | ||
| $replyTo | mixed | |
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( mixed $to ): self | ||
| $to | mixed | |
public function setTo($to): self
{
$this->email->to(...$this->convertStringsToAddresses($to));
return $this;
}