Class yii\swiftmailer\Message

Inheritanceyii\swiftmailer\Message » yii\mail\BaseMessage
Available since version2.0

Message implements a message class based on SwiftMailer.

See also:

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__clone() This method is called after the object is created by cloning an existing one. yii\swiftmailer\Message
addHeader() Adds custom header value to the message. yii\swiftmailer\Message
addSignature() Adds message signature. yii\swiftmailer\Message
attach() yii\swiftmailer\Message
attachContent() yii\swiftmailer\Message
embed() yii\swiftmailer\Message
embedContent() yii\swiftmailer\Message
getBcc() yii\swiftmailer\Message
getCc() yii\swiftmailer\Message
getCharset() yii\swiftmailer\Message
getFrom() 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() yii\swiftmailer\Message
getReturnPath() Returns the return-path (the bounce address) of this message. yii\swiftmailer\Message
getSubject() yii\swiftmailer\Message
getSwiftMessage() yii\swiftmailer\Message
getTo() yii\swiftmailer\Message
setBcc() yii\swiftmailer\Message
setCc() yii\swiftmailer\Message
setCharset() yii\swiftmailer\Message
setFrom() 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() 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() 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() yii\swiftmailer\Message
setTextBody() yii\swiftmailer\Message
setTo() yii\swiftmailer\Message
toString() yii\swiftmailer\Message

Protected Methods

Hide inherited methods

MethodDescriptionDefined 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

__clone() public method (available since version 2.0.7)

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 ( )
addHeader() public method (available since version 2.0.6)

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.

addSignature() public method (available since version 2.0.6)

Adds message signature.

public $this addSignature ( $signature )
$signature array|callable|\Swift_Signer

Signature specification, this can be:

  • \Swift_Signer instance
  • callable, which returns \Swift_Signer instance
  • configuration array for the signer creation
return $this

Self reference

throws \yii\base\InvalidConfigException

on invalid signature configuration

attach() public method

public void attach ( $fileName, array $options = [] )
$fileName
$options
attachContent() public method

public void attachContent ( $content, array $options = [] )
$content
$options
createSwiftMessage() protected method

Creates the Swift email message instance.

protected \Swift_Message createSwiftMessage ( )
return \Swift_Message

Email message instance.

createSwiftSigner() protected method (available since version 2.0.6)

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

embed() public method

public void embed ( $fileName, array $options = [] )
$fileName
$options
embedContent() public method

public void embedContent ( $content, array $options = [] )
$content
$options
getBcc() public method

public void getBcc ( )
getCc() public method

public void getCc ( )
getCharset() public method

public void getCharset ( )
getFrom() public method

public void getFrom ( )
getHeader() public method (available since version 2.0.6)

Returns all values for the specified header.

public array getHeader ( $name )
$name string

Header name.

return array

Header values list.

getPriority() public method (available since version 2.0.6)

Returns the priority of this message.

public integer getPriority ( )
return integer

Priority value as integer in range: 1..5, where 1 is the highest priority and 5 is the lowest.

getReadReceiptTo() public method (available since version 2.0.6)

Get the addresses to which a read-receipt will be sent.

public string getReadReceiptTo ( )
return string

Receipt receive email addresses.

getReplyTo() public method

public void getReplyTo ( )
getReturnPath() public method (available since version 2.0.6)

Returns the return-path (the bounce address) of this message.

public string getReturnPath ( )
return string

The bounce email address.

getSubject() public method

public void getSubject ( )
getSwiftMessage() public method

public \Swift_Message getSwiftMessage ( )
return \Swift_Message

Swift message instance.

getTo() public method

public void getTo ( )
setBcc() public method

public void setBcc ( $bcc )
$bcc
setBody() protected method

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.

setCc() public method

public void setCc ( $cc )
$cc
setCharset() public method

public void setCharset ( $charset )
$charset
setFrom() public method

public void setFrom ( $from )
$from
setHeader() public method (available since version 2.0.6)

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.

setHeaders() public method (available since version 2.0.7)

Sets custom header values to the message.

public $this setHeaders ( $headers )
$headers array

Headers in format: [name => value].

return $this

Self reference.

setHtmlBody() public method

public void setHtmlBody ( $html )
$html
setPriority() public method (available since version 2.0.6)

Set the priority of this message.

public $this setPriority ( $priority )
$priority integer

Priority value, should be an integer in range: 1..5, where 1 is the highest priority and 5 is the lowest.

return $this

Self reference.

setReadReceiptTo() public method (available since version 2.0.6)

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.

setReplyTo() public method

public void setReplyTo ( $replyTo )
$replyTo
setReturnPath() public method (available since version 2.0.6)

Set the return-path (the bounce address) of this message.

public $this setReturnPath ( $address )
$address string

The bounce email address.

return $this

Self reference.

setSignature() public method (available since version 2.0.6)

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.

setSubject() public method

public void setSubject ( $subject )
$subject
setTextBody() public method

public void setTextBody ( $text )
$text
setTo() public method

public void setTo ( $to )
$to
toString() public method

public void toString ( )