Class yii\swiftmailer\Message

Inheritanceyii\swiftmailer\Message » yii\mail\BaseMessage » yii\base\Object
Implementsyii\base\Configurable, yii\mail\MessageInterface
Available since version2.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

Hide inherited properties

PropertyTypeDescriptionDefined By
$bcc array The Bcc (hidden copy receiver) addresses of this message. yii\swiftmailer\Message
$cc array The Cc (additional copy receiver) addresses of this message. yii\swiftmailer\Message
$charset string The character set of this message. yii\swiftmailer\Message
$from string The sender yii\swiftmailer\Message
$htmlBody string Message HTML content. yii\swiftmailer\Message
$mailer yii\mail\MailerInterface The mailer instance that created this message. yii\mail\BaseMessage
$replyTo string The reply-to address of this message. yii\swiftmailer\Message
$subject string The message subject yii\swiftmailer\Message
$swiftMessage \Swift_Message Swift message instance. yii\swiftmailer\Message
$textBody string Message plain text content. yii\swiftmailer\Message
$to array The message recipients yii\swiftmailer\Message

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Object
__construct() Constructor. yii\base\Object
__get() Returns the value of an object property. yii\base\Object
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Object
__set() Sets value of an object property. yii\base\Object
__toString() PHP magic method that returns the string representation of this object. yii\mail\BaseMessage
__unset() Sets an object property to null. yii\base\Object
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\Object
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Object
className() Returns the fully qualified name of this class. yii\base\Object
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
getReplyTo() Returns the reply-to 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\Object
hasProperty() Returns a value indicating whether a property is defined. yii\base\Object
init() Initializes the object. yii\base\Object
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
setHtmlBody() Sets message HTML content. yii\swiftmailer\Message
setReplyTo() Sets the reply-to address of this message. 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

Hide inherited methods

MethodDescriptionDefined By
createSwiftMessage() Creates the Swift email message instance. yii\swiftmailer\Message
setBody() Sets the message body. yii\swiftmailer\Message

Property Details

$bcc public property
array getBcc( )
$this setBcc$bcc )

The Bcc (hidden copy receiver) addresses of this message.

$cc public property
array getCc( )
$this setCc$cc )

The Cc (additional copy receiver) addresses of this message.

$charset public property
string getCharset( )
$this setCharset$charset )

The character set of this message.

$from public property
string getFrom( )
$this setFrom$from )

The sender

$htmlBody public write-only property
$this setHtmlBody$html )

Message HTML content.

$replyTo public property
string getReplyTo( )
$this setReplyTo$replyTo )

The reply-to address of this message.

$subject public property
string getSubject( )
$this setSubject$subject )

The message subject

$swiftMessage public read-only property
\Swift_Message getSwiftMessage( )

Swift message instance.

$textBody public write-only property
$this setTextBody$text )

Message plain text content.

$to public property
array getTo( )
$this setTo$to )

The message recipients

Method Details

attach() public method

Attaches existing file to the email message.

$this attach$fileName, array $options = [] )
$fileName string

Full file name

$options array

Options for embed file. Valid options are:

  • fileName: name, which should be used to attach file.
  • contentType: attached file MIME type.
return $this

Self reference.

attachContent() public method

Attach specified content as file for the email message.

$this attachContent$content, array $options = [] )
$content string

Attachment file content.

$options array

Options for embed file. Valid options are:

  • fileName: name, which should be used to attach file.
  • contentType: attached file MIME type.
return $this

Self reference.

createSwiftMessage() protected method

Creates the Swift email message instance.

\Swift_Message createSwiftMessage( )
return \Swift_Message

Email message instance.

embed() public method

Attach a file and return it's CID source.

This method should be used when embedding images or other data in a message.

string embed$fileName, array $options = [] )
$fileName string

File name.

$options array

Options for embed file. Valid options are:

  • fileName: name, which should be used to attach file.
  • contentType: attached file MIME type.
return string

Attachment CID.

embedContent() public method

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.

string embedContent$content, array $options = [] )
$content string

Attachment file content.

$options array

Options for embed file. Valid options are:

  • fileName: name, which should be used to attach file.
  • contentType: attached file MIME type.
return string

Attachment CID.

getBcc() public method

Returns the Bcc (hidden copy receiver) addresses of this message.

array getBcc( )
return array

The Bcc (hidden copy receiver) addresses of this message.

getCc() public method

Returns the Cc (additional copy receiver) addresses of this message.

array getCc( )
return array

The Cc (additional copy receiver) addresses of this message.

getCharset() public method

Returns the character set of this message.

string getCharset( )
return string

The character set of this message.

getFrom() public method

Returns the message sender.

string getFrom( )
return string

The sender

getReplyTo() public method

Returns the reply-to address of this message.

string getReplyTo( )
return string

The reply-to address of this message.

getSubject() public method

Returns the message subject.

string getSubject( )
return string

The message subject

getSwiftMessage() public method

\Swift_Message getSwiftMessage( )
return \Swift_Message

Swift message instance.

getTo() public method

Returns the message recipient(s).

array getTo( )
return array

The message recipients

setBcc() public method

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

$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: [email => name].

return $this

Self reference.

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.

void setBody$body$contentType )
$body string

Body content.

$contentType string

Body content type.

setCc() public method

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

$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: [email => name].

return $this

Self reference.

setCharset() public method

Sets the character set of this message.

$this setCharset$charset )
$charset string

Character set name.

return $this

Self reference.

setFrom() public method

Sets the message sender.

$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: [email => name].

return $this

Self reference.

setHtmlBody() public method

Sets message HTML content.

$this setHtmlBody$html )
$html string

Message HTML content.

return $this

Self reference.

setReplyTo() public method

Sets the reply-to address of this message.

$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: [email => name].

return $this

Self reference.

setSubject() public method

Sets the message subject.

$this setSubject$subject )
$subject string

Message subject

return $this

Self reference.

setTextBody() public method

Sets message plain text content.

$this setTextBody$text )
$text string

Message plain text content.

return $this

Self reference.

setTo() public method

Sets the message recipient(s).

$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: [email => name].

return $this

Self reference.

toString() public method

Returns string representation of this message.

string toString( )
return string

The string representation of this message.