Message
- Type
- Class
- Namespace
- craft\mail
- Inherits
- craft\mail\Message » yii\swiftmailer\Message (opens new window) » yii\mail\BaseMessage (opens new window) » yii\base\BaseObject (opens new window)
- Implements
- yii\base\Configurable (opens new window), yii\mail\MessageInterface (opens new window)
- Since
- 3.0.0
Represents an email message.
View source (opens new window)
# Public Properties
# error
- Type
\craft\mail\Swift_TransportException
, 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 |
---|---|
__call() (opens new window) | Calls the named method which is not a class method. |
__clone() (opens new window) | This method is called after the object is created by cloning an existing one. |
__construct() (opens new window) | Constructor. |
__get() (opens new window) | Returns the value of an object property. |
__isset() (opens new window) | Checks if a property is set, i.e. defined and not null. |
__set() (opens new window) | Sets value of an object property. |
__toString() (opens new window) | PHP magic method that returns the string representation of this object. |
__unset() (opens new window) | Sets an object property to null. |
addHeader() (opens new window) | Adds custom header value to the message. |
addSignature() (opens new window) | Adds message signature. |
attach() (opens new window) | Attaches existing file to the email message. |
attachContent() (opens new window) | Attach specified content as file for the email message. |
canGetProperty() (opens new window) | Returns a value indicating whether a property can be read. |
canSetProperty() (opens new window) | Returns a value indicating whether a property can be set. |
className() (opens new window) | Returns the fully qualified name of this class. |
embed() (opens new window) | Attach a file and return it's CID source. |
embedContent() (opens new window) | Attach a content as file and return it's CID source. |
getBcc() (opens new window) | Returns the Bcc (hidden copy receiver) addresses of this message. |
getCc() (opens new window) | Returns the Cc (additional copy receiver) addresses of this message. |
getCharset() (opens new window) | Returns the character set of this message. |
getFrom() (opens new window) | Returns the message sender. |
getHeader() (opens new window) | Returns all values for the specified header. |
getMailer() (opens new window) | returns mailer instance. |
getPriority() (opens new window) | Returns the priority of this message. |
getReadReceiptTo() (opens new window) | Get the addresses to which a read-receipt will be sent. |
getReplyTo() (opens new window) | Returns the reply-to address of this message. |
getReturnPath() (opens new window) | Returns the return-path (the bounce address) of this message. |
getSubject() (opens new window) | Returns the message subject. |
getSwiftMessage() (opens new window) | |
getTo() (opens new window) | Returns the message recipient(s). |
hasMethod() (opens new window) | Returns a value indicating whether a method is defined. |
hasProperty() (opens new window) | Returns a value indicating whether a property is defined. |
init() (opens new window) | Initializes the object. |
send() (opens new window) | Sends this email message. |
setBcc() | Sets the BCC (hidden copy receiver) addresses of this message. |
setCc() | Sets the CC (additional copy receiver) addresses of this message. |
setCharset() (opens new window) | Sets the character set of this message. |
setFrom() | Sets the message sender. |
setHeader() (opens new window) | Sets custom header value to the message. |
setHeaders() (opens new window) | Sets custom header values to the message. |
setHtmlBody() (opens new window) | Sets message HTML content. |
setPriority() (opens new window) | Set the priority of this message. |
setReadReceiptTo() (opens new window) | Sets the ask for a delivery receipt from the recipient to be sent to $addresses. |
setReplyTo() | Sets the Reply-To email. |
setReturnPath() (opens new window) | Set the return-path (the bounce address) of this message. |
setSignature() (opens new window) | Sets message signature |
setSubject() (opens new window) | Sets the message subject. |
setTextBody() (opens new window) | Sets message plain text content. |
setTo() | Sets the message recipient(s). |
toString() (opens new window) | Returns string representation of this message. |
# setBcc()
Sets the BCC (hidden copy receiver) addresses of this message.
View source (opens new window)
Arguments
$bcc
(string (opens new window), array (opens new window), craft\elements\User, craft\elements\User[]) – 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
static
– Self reference
# setCc()
Sets the CC (additional copy receiver) addresses of this message.
View source (opens new window)
Arguments
$cc
(string (opens new window), array (opens new window), craft\elements\User, 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
static
– Self reference
# setFrom()
Sets the message sender.
View source (opens new window)
Arguments
$from
(string (opens new window), array (opens new window), craft\elements\User, 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
static
– Self reference
# setReplyTo()
- Since
- 3.4.0
Sets the Reply-To email.
View source (opens new window)
Arguments
$replyTo
(string (opens new window), array (opens new window), craft\elements\User, 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
static
– Self reference
# setTo()
Sets the message recipient(s).
View source (opens new window)
Arguments
$to
(string (opens new window), array (opens new window), craft\elements\User, 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
static
– Self reference
# Protected Methods
Method | Description |
---|---|
createSwiftMessage() (opens new window) | Creates the Swift email message instance. |
createSwiftSigner() (opens new window) | Creates signer from it's configuration. |
setBody() (opens new window) | Sets the message body. |