Message
- Type
- Class
- Namespace
- craft\mail
- Inherits
- craft\mail\Message »
yii\symfonymailer\Message
- Since
- 3.0.0
Represents an email message.
View source (opens new window)
# Public Properties
Property | Description |
---|---|
error | \Symfony\Component\Mailer\Exception\TransportExceptionInterface , null (opens new window) – The caught error object, if the message failed to send |
key | string (opens new window), null (opens new window) – The key of the message that should be loaded |
language | string (opens new window), null (opens new window) – 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 (opens new window), null (opens new window) – Any variables that should be applied to the template when it is rendered |
# error
- Type
\Symfony\Component\Mailer\Exception\TransportExceptionInterface
, null (opens new window)- Default value
null
The caught error object, if the message failed to send
View source (opens new window)
# key
- Type
- string (opens new window), null (opens new window)
- Default value
null
The key of the message that should be loaded
View source (opens new window)
# language
- Type
- string (opens new window), null (opens new window)
- Default value
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
View source (opens new window)
# variables
- Type
- array (opens new window), null (opens new window)
- Default value
null
Any variables that should be applied to the template when it is rendered
View source (opens new window)
# 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.
View source (opens new window)
Arguments
$bcc
(string (opens new window),(\craft\elements\User|string)[]
, craft\elements\User, null (opens new window)) – 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.
View source (opens new window)
Arguments
$cc
(string (opens new window),(\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.
View source (opens new window)
Arguments
$from
(string (opens new window),(\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]
.
Returns
self
– Self reference
# setReplyTo()
- Since
- 3.4.0
Sets the Reply-To email.
View source (opens new window)
Arguments
$replyTo
(string (opens new window),(\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).
View source (opens new window)
Arguments
$to
(string (opens new window),(\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