Message ​
- Type
- Class
- Namespace
- craft\mail
- Inherits
- craft\mail\Message »
yii\symfonymailer\Message
- Since
- 3.0.0
Represents an email message.
Public Properties ​
Property | Description |
---|---|
error | \Symfony\Component\Mailer\Exception\TransportExceptionInterface , null – The caught error object, if the message failed to send |
key | string, null – The key of the message that should be loaded |
language | string, null – The language that the email should be sent in, based on the first craft\elements\User model passed into setTo() with a preferred language |
variables | array, null – Any variables that should be applied to the template when it is rendered |
error
​
- Type
\Symfony\Component\Mailer\Exception\TransportExceptionInterface
, null- Default value
null
The caught error object, if the message failed to send
key
​
The key of the message that should be loaded
language
​
The language that the email should be sent in, based on the first craft\elements\User model passed into setTo() with a preferred language
variables
​
Any variables that should be applied to the template when it is rendered
Public Methods ​
Method | Description |
---|---|
setBcc() | Sets the BCC (hidden copy receiver) addresses of this message. |
setCc() | Sets the CC (additional copy receiver) addresses of this message. |
setFrom() | Sets the message sender. |
setReplyTo() | Sets the Reply-To email. |
setTo() | Sets the message recipient(s). |
setBcc()
​
Sets the BCC (hidden copy receiver) addresses of this message.
Arguments ​
$bcc
(string,(\craft\elements\User|string)[]
, craft\elements\User, null) – The hidden copied receiver’s email address, or their user model(s). You may pass an array of addresses if multiple recipients should receive this message. You may also specify receiver name in addition to email address using format:[email => name]
.
Returns ​
self
– Self reference
setCc()
​
Sets the CC (additional copy receiver) addresses of this message.
Arguments ​
$cc
(string,(\craft\elements\User|string)[]
, craft\elements\User) – The copied receiver’s email address, or their user model(s). You may pass an array of addresses if multiple recipients should receive this message. You may also specify receiver name in addition to email address using format:[email => name]
.
Returns ​
self
– Self reference
setFrom()
​
Sets the message sender.
Arguments ​
$from
(string,(\craft\elements\User|string)[]
, craft\elements\User) – The sender’s email address, or their user model(s). You may pass an array of addresses if this message is from multiple people. You may also specify sender name in addition to email address using format:[email => name]
.
setReplyTo()
​
- Since
- 3.4.0
Sets the Reply-To email.
Arguments ​
$replyTo
(string,(\craft\elements\User|string)[]
, craft\elements\User) – The Reply-To email address, or their user model(s). You may pass an array of addresses if this message is from multiple people. You may also specify Reply-To name in addition to email address using format:[email => name]
.
Returns ​
self
– Self reference
setTo()
​
Sets the message recipient(s).
Arguments ​
$to
(string,(\craft\elements\User|string)[]
, craft\elements\User) – The receiver’s email address, or their user model(s). You may pass an array of addresses if multiple recipients should receive this message. You may also specify receiver name in addition to email address using format:[email => name]
.
Returns ​
self
– Self reference