Class yii\swiftmailer\Message
Inheritance | yii\swiftmailer\Message » yii\mail\BaseMessage » yii\base\BaseObject |
---|---|
Implements | yii\base\Configurable, yii\mail\MessageInterface |
Available since version | 2.0 |
Source Code | https://github.com/yiisoft/yii2-swiftmailer/blob/master/Message.php |
Message implements a message class based on SwiftMailer.
See also:
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$mailer | yii\mail\MailerInterface | The mailer instance that created this message. | yii\mail\BaseMessage |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\BaseObject |
__clone() | This method is called after the object is created by cloning an existing one. | yii\swiftmailer\Message |
__construct() | Constructor. | yii\base\BaseObject |
__get() | Returns the value of an object property. | yii\base\BaseObject |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\BaseObject |
__set() | Sets value of an object property. | yii\base\BaseObject |
__toString() | PHP magic method that returns the string representation of this object. | yii\mail\BaseMessage |
__unset() | Sets an object property to null. | yii\base\BaseObject |
addHeader() | Adds custom header value to the message. | yii\swiftmailer\Message |
addSignature() | Adds message signature. | yii\swiftmailer\Message |
attach() | Attaches existing file to the email message. | yii\swiftmailer\Message |
attachContent() | Attach specified content as file for the email message. | yii\swiftmailer\Message |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\BaseObject |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\BaseObject |
className() | Returns the fully qualified name of this class. | yii\base\BaseObject |
embed() | Attach a file and return it's CID source. | yii\swiftmailer\Message |
embedContent() | Attach a content as file and return it's CID source. | yii\swiftmailer\Message |
getBcc() | Returns the Bcc (hidden copy receiver) addresses of this message. | yii\swiftmailer\Message |
getCc() | Returns the Cc (additional copy receiver) addresses of this message. | yii\swiftmailer\Message |
getCharset() | Returns the character set of this message. | yii\swiftmailer\Message |
getFrom() | Returns the message sender. | yii\swiftmailer\Message |
getHeader() | Returns all values for the specified header. | yii\swiftmailer\Message |
getPriority() | Returns the priority of this message. | yii\swiftmailer\Message |
getReadReceiptTo() | Get the addresses to which a read-receipt will be sent. | yii\swiftmailer\Message |
getReplyTo() | Returns the reply-to address of this message. | yii\swiftmailer\Message |
getReturnPath() | Returns the return-path (the bounce address) of this message. | yii\swiftmailer\Message |
getSubject() | Returns the message subject. | yii\swiftmailer\Message |
getSwiftMessage() | yii\swiftmailer\Message | |
getTo() | Returns the message recipient(s). | yii\swiftmailer\Message |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\BaseObject |
hasProperty() | Returns a value indicating whether a property is defined. | yii\base\BaseObject |
init() | Initializes the object. | yii\base\BaseObject |
send() | Sends this email message. | yii\mail\BaseMessage |
setBcc() | Sets the Bcc (hidden copy receiver) addresses of this message. | yii\swiftmailer\Message |
setCc() | Sets the Cc (additional copy receiver) addresses of this message. | yii\swiftmailer\Message |
setCharset() | Sets the character set of this message. | yii\swiftmailer\Message |
setFrom() | Sets the message sender. | yii\swiftmailer\Message |
setHeader() | Sets custom header value to the message. | yii\swiftmailer\Message |
setHeaders() | Sets custom header values to the message. | yii\swiftmailer\Message |
setHtmlBody() | Sets message HTML content. | yii\swiftmailer\Message |
setPriority() | Set the priority of this message. | yii\swiftmailer\Message |
setReadReceiptTo() | Sets the ask for a delivery receipt from the recipient to be sent to $addresses. | yii\swiftmailer\Message |
setReplyTo() | Sets the reply-to address of this message. | yii\swiftmailer\Message |
setReturnPath() | Set the return-path (the bounce address) of this message. | yii\swiftmailer\Message |
setSignature() | Sets message signature | yii\swiftmailer\Message |
setSubject() | Sets the message subject. | yii\swiftmailer\Message |
setTextBody() | Sets message plain text content. | yii\swiftmailer\Message |
setTo() | Sets the message recipient(s). | yii\swiftmailer\Message |
toString() | Returns string representation of this message. | yii\swiftmailer\Message |
Protected Methods
Method | Description | Defined By |
---|---|---|
createSwiftMessage() | Creates the Swift email message instance. | yii\swiftmailer\Message |
createSwiftSigner() | Creates signer from its configuration | yii\swiftmailer\Message |
setBody() | Sets the message body. | yii\swiftmailer\Message |
Method Details
This method is called after the object is created by cloning an existing one.
It ensures \yii\swiftmailer\swiftMessage is also cloned.
public void __clone ( ) |
Adds custom header value to the message.
Several invocations of this method with the same name will add multiple header values.
public $this addHeader ( $name, $value ) | ||
$name | string | Header name. |
$value | string | Header value. |
return | $this | Self reference. |
---|
Adds message signature.
public $this addSignature ( $signature ) | ||
$signature | array|callable|\Swift_Signer | Signature specification, this can be:
|
return | $this | Self reference |
---|---|---|
throws | yii\base\InvalidConfigException | on invalid signature configuration |
Attaches existing file to the email message.
public $this attach ( $fileName, array $options = [] ) | ||
$fileName | string | Full file name |
$options | array | Options for embed file. Valid options are:
|
return | $this | Self reference. |
---|
Attach specified content as file for the email message.
public $this attachContent ( $content, array $options = [] ) | ||
$content | string | Attachment file content. |
$options | array | Options for embed file. Valid options are:
|
return | $this | Self reference. |
---|
Creates the Swift email message instance.
protected \Swift_Message createSwiftMessage ( ) | ||
return | \Swift_Message | Email message instance. |
---|
Creates signer from its configuration
protected \Swift_Signer createSwiftSigner ( $signature ) | ||
$signature | array | Signature configuration |
return | \Swift_Signer | Signer instance |
---|---|---|
throws | yii\base\InvalidConfigException | on invalid configuration provided |
Attach a file and return it's CID source.
This method should be used when embedding images or other data in a message.
public string embed ( $fileName, array $options = [] ) | ||
$fileName | string | File name. |
$options | array | Options for embed file. Valid options are:
|
return | string | Attachment CID. |
---|
Attach a content as file and return it's CID source.
This method should be used when embedding images or other data in a message.
public string embedContent ( $content, array $options = [] ) | ||
$content | string | Attachment file content. |
$options | array | Options for embed file. Valid options are:
|
return | string | Attachment CID. |
---|
Returns the Bcc (hidden copy receiver) addresses of this message.
public string|array getBcc ( ) | ||
return | string|array | The Bcc (hidden copy receiver) addresses of this message. |
---|
Returns the Cc (additional copy receiver) addresses of this message.
public string|array getCc ( ) | ||
return | string|array | The Cc (additional copy receiver) addresses of this message. |
---|
Returns the character set of this message.
public string getCharset ( ) | ||
return | string | The character set of this message. |
---|
Returns the message sender.
public string|array getFrom ( ) | ||
return | string|array | The sender |
---|
Returns all values for the specified header.
public array getHeader ( $name ) | ||
$name | string | Header name. |
return | array | Header values list. |
---|
Returns the priority of this message.
public integer getPriority ( ) | ||
return | integer | Priority value as integer in range: |
---|
Get the addresses to which a read-receipt will be sent.
public string getReadReceiptTo ( ) | ||
return | string | Receipt receive email addresses. |
---|
Returns the reply-to address of this message.
public string|array getReplyTo ( ) | ||
return | string|array | The reply-to address of this message. |
---|
Returns the return-path (the bounce address) of this message.
public string getReturnPath ( ) | ||
return | string | The bounce email address. |
---|
Returns the message subject.
public string getSubject ( ) | ||
return | string | The message subject |
---|
public \Swift_Message getSwiftMessage ( ) | ||
return | \Swift_Message | Swift message instance. |
---|
Returns the message recipient(s).
public string|array getTo ( ) | ||
return | string|array | The message recipients |
---|
Sets the Bcc (hidden copy receiver) addresses of this message.
public $this setBcc ( $bcc ) | ||
$bcc | string|array | Hidden copy receiver email address.
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:
|
return | $this | Self reference. |
---|
Sets the message body.
If body is already set and its content type matches given one, it will be overridden, if content type miss match the multipart message will be composed.
protected void setBody ( $body, $contentType ) | ||
$body | string | Body content. |
$contentType | string | Body content type. |
Sets the Cc (additional copy receiver) addresses of this message.
public $this setCc ( $cc ) | ||
$cc | string|array | Copy receiver email address.
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:
|
return | $this | Self reference. |
---|
Sets the character set of this message.
public $this setCharset ( $charset ) | ||
$charset | string | Character set name. |
return | $this | Self reference. |
---|
Sets the message sender.
public $this setFrom ( $from ) | ||
$from | string|array | Sender email address.
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:
|
return | $this | Self reference. |
---|
Sets custom header value to the message.
public $this setHeader ( $name, $value ) | ||
$name | string | Header name. |
$value | string|array | Header value or values. |
return | $this | Self reference. |
---|
Sets custom header values to the message.
public $this setHeaders ( $headers ) | ||
$headers | array | Headers in format: |
return | $this | Self reference. |
---|
Sets message HTML content.
public $this setHtmlBody ( $html ) | ||
$html | string | Message HTML content. |
return | $this | Self reference. |
---|
Set the priority of this message.
public $this setPriority ( $priority ) | ||
$priority | integer | Priority value, should be an integer in range: |
return | $this | Self reference. |
---|
Sets the ask for a delivery receipt from the recipient to be sent to $addresses.
public $this setReadReceiptTo ( $addresses ) | ||
$addresses | string|array | Receipt receive email address(es). |
return | $this | Self reference. |
---|
Sets the reply-to address of this message.
public $this setReplyTo ( $replyTo ) | ||
$replyTo | string|array | The reply-to address.
You may pass an array of addresses if this message should be replied to multiple people.
You may also specify reply-to name in addition to email address using format:
|
return | $this | Self reference. |
---|
Set the return-path (the bounce address) of this message.
public $this setReturnPath ( $address ) | ||
$address | string | The bounce email address. |
return | $this | Self reference. |
---|
Sets message signature
public $this setSignature ( $signature ) | ||
$signature | array|callable|\Swift_Signer | Signature specification. See addSignature() for details on how it should be specified. |
return | $this | Self reference. |
---|
Sets the message subject.
public $this setSubject ( $subject ) | ||
$subject | string | Message subject |
return | $this | Self reference. |
---|
Sets message plain text content.
public $this setTextBody ( $text ) | ||
$text | string | Message plain text content. |
return | $this | Self reference. |
---|
Sets the message recipient(s).
public $this setTo ( $to ) | ||
$to | string|array | Receiver email address.
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:
|
return | $this | Self reference. |
---|
Returns string representation of this message.
public string toString ( ) | ||
return | string | The string representation of this message. |
---|