Abstract Class yii\mail\BaseMessage

继承yii\mail\BaseMessage » yii\base\BaseObject
实现yii\base\Configurable, yii\mail\MessageInterface
可用自版本2.0
源代码 https://github.com/yiisoft/yii2/blob/master/framework/mail/BaseMessage.php

BaseMessage serves as a base class that implements the send() method required by yii\mail\MessageInterface.

By default, send() will use the "mailer" application component to send the current message. The "mailer" application component should be a mailer instance implementing yii\mail\MailerInterface.

参见 yii\mail\BaseMailer.

公共属性

隐藏继承的属性

属性类型描述定义在
$bcc string|array The Bcc (hidden copy receiver) addresses of this message. yii\mail\MessageInterface
$cc string|array The Cc (additional copy receiver) addresses of this message. yii\mail\MessageInterface
$charset string The character set of this message. yii\mail\MessageInterface
$from string|array The sender yii\mail\MessageInterface
$htmlBody string Message HTML content. yii\mail\MessageInterface
$mailer yii\mail\MailerInterface The mailer instance that created this message. yii\mail\BaseMessage
$replyTo string|array The reply-to address of this message. yii\mail\MessageInterface
$subject string The message subject yii\mail\MessageInterface
$textBody string Message plain text content. yii\mail\MessageInterface
$to string|array The message recipients yii\mail\MessageInterface

公共方法

隐藏继承的方法

方法描述定义在
__call() 调用不是类方法的已命名方法. yii\base\BaseObject
__construct() 构造函数. yii\base\BaseObject
__get() 返回对象属性的值. yii\base\BaseObject
__isset() 检查属性是否已设置, 即已定义且不为null. yii\base\BaseObject
__set() 设置对象属性的值. yii\base\BaseObject
__toString() PHP magic method that returns the string representation of this object. yii\mail\BaseMessage
__unset() 将对象属性设置为null. yii\base\BaseObject
attach() Attaches existing file to the email message. yii\mail\MessageInterface
attachContent() Attach specified content as file for the email message. yii\mail\MessageInterface
canGetProperty() 返回一个值, 指示属性是否可读. yii\base\BaseObject
canSetProperty() 返回一个值, 指示属性是否可写. yii\base\BaseObject
className() 返回此类的完全限定名称. yii\base\BaseObject
embed() Attach a file and return it's CID source. yii\mail\MessageInterface
embedContent() Attach a content as file and return it's CID source. yii\mail\MessageInterface
getBcc() Returns the Bcc (hidden copy receiver) addresses of this message. yii\mail\MessageInterface
getCc() Returns the Cc (additional copy receiver) addresses of this message. yii\mail\MessageInterface
getCharset() Returns the character set of this message. yii\mail\MessageInterface
getFrom() Returns the message sender. yii\mail\MessageInterface
getReplyTo() Returns the reply-to address of this message. yii\mail\MessageInterface
getSubject() Returns the message subject. yii\mail\MessageInterface
getTo() Returns the message recipient(s). yii\mail\MessageInterface
hasMethod() 返回一个值, 指示方法是否已定义. yii\base\BaseObject
hasProperty() 返回一个值, 指示属性是否已定义. yii\base\BaseObject
init() 初始化对象. yii\base\BaseObject
send() Sends this email message. yii\mail\BaseMessage
setBcc() Sets the Bcc (hidden copy receiver) addresses of this message. yii\mail\MessageInterface
setCc() Sets the Cc (additional copy receiver) addresses of this message. yii\mail\MessageInterface
setCharset() Sets the character set of this message. yii\mail\MessageInterface
setFrom() Sets the message sender. yii\mail\MessageInterface
setHtmlBody() Sets message HTML content. yii\mail\MessageInterface
setReplyTo() Sets the reply-to address of this message. yii\mail\MessageInterface
setSubject() Sets the message subject. yii\mail\MessageInterface
setTextBody() Sets message plain text content. yii\mail\MessageInterface
setTo() Sets the message recipient(s). yii\mail\MessageInterface
toString() Returns string representation of this message. yii\mail\MessageInterface

属性详情

$mailer public 属性

The mailer instance that created this message. For independently created messages this is null.

方法详情

__toString() public 方法

PHP magic method that returns the string representation of this object.

public string __toString ( )
return string

The string representation of this object.

send() public 方法

Sends this email message.

public boolean send ( yii\mail\MailerInterface $mailer null )
$mailer yii\mail\MailerInterface

The mailer that should be used to send this message. If no mailer is given it will first check if $mailer is set and if not, the "mailer" application component will be used instead.

return boolean

Whether this message is sent successfully.