Craft 3 Class Reference

Class craft\mail\Message

Inheritance
craft\mail\Message » yii\swiftmailer\Message
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/mail/Message.php

Represents an email message.

Public Properties
Property Type Description Defined By
$key string, null The key of the message that should be loaded craft\mail\Message
$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 craft\mail\Message
$variables array, null Any variables that should be applied to the template when it is rendered craft\mail\Message
Public Methods
Method Description Defined By
setBcc() Sets the BCC (hidden copy receiver) addresses of this message. craft\mail\Message
setCc() Sets the CC (additional copy receiver) addresses of this message. craft\mail\Message
setFrom() Sets the message sender. craft\mail\Message
setTo() Sets the message recipient(s). craft\mail\Message

Property Details

$key public property #

The key of the message that should be loaded

public string, null $key null

$language public property #

The language that the email should be sent in, based on the first craft\elements\User model passed into setTo() with a preferred language

public string, null $language null

$variables public property #

Any variables that should be applied to the template when it is rendered

public array, null $variables null

Method Details

setBcc() public method #

Sets the BCC (hidden copy receiver) addresses of this message.

public static setBcc ( $bcc )
$bcc string, array, craft\elements\User, craft\elements\User[] The hidden copied receiver’ 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].
return static Self reference

setCc() public method #

Sets the CC (additional copy receiver) addresses of this message.

public static setCc ( $cc )
$cc string, array, 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].
return static Self reference

setFrom() public method #

Sets the message sender.

public static setFrom ( $from )
$from string, array, 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].
return static Self reference

setTo() public method #

Sets the message recipient(s).

public static setTo ( $to )
$to string, array, 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].
return static Self reference