PHP Интерфейс yii\mail\MessageInterface

A message represents the settings and content of an email, such as the sender, recipient, subject, body, etc. Messages are sent by a [[\yii\mail\MailerInterface|mailer]], like the following, ~~~ Yii::$app->mailer->compose() ->setFrom('[email protected]') ->setTo($form->email) ->setSubject($form->subject) ->setTextBody('Plain text content') ->setHtmlBody('HTML content') ->send(); ~~~
См. также: MailerInterface
С версии: 2.0
Автор: Paul Klimov ([email protected])
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
attach ( string $fileName, array $options = [] ) Attaches existing file to the email message.
attachContent ( string $content, array $options = [] ) Attach specified content as file for the email message.
embed ( string $fileName, array $options = [] ) : string Attach a file and return it's CID source.
embedContent ( string $content, array $options = [] ) : string Attach a content as file and return it's CID source.
getBcc ( ) : array Returns the Bcc (hidden copy receiver) addresses of this message.
getCc ( ) : array Returns the Cc (additional copy receiver) addresses of this message.
getCharset ( ) : string Returns the character set of this message.
getFrom ( ) : string Returns the message sender.
getReplyTo ( ) : string Returns the reply-to address of this message.
getSubject ( ) : string Returns the message subject.
getTo ( ) : array Returns the message recipient(s).
send ( yii\mail\MailerInterface $mailer = null ) : boolean Sends this email message.
setBcc ( string | array $bcc ) Sets the Bcc (hidden copy receiver) addresses of this message.
setCc ( string | array $cc ) Sets the Cc (additional copy receiver) addresses of this message.
setCharset ( string $charset ) Sets the character set of this message.
setFrom ( string | array $from ) Sets the message sender.
setHtmlBody ( string $html ) Sets message HTML content.
setReplyTo ( string | array $replyTo ) Sets the reply-to address of this message.
setSubject ( string $subject ) Sets the message subject.
setTextBody ( string $text ) Sets message plain text content.
setTo ( string | array $to ) Sets the message recipient(s).
toString ( ) : string Returns string representation of this message.

Описание методов

attach() публичный Метод

Attaches existing file to the email message.
public attach ( string $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.

attachContent() публичный Метод

Attach specified content as file for the email message.
public attachContent ( string $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.

embed() публичный Метод

This method should be used when embedding images or other data in a message.
public embed ( string $fileName, array $options = [] ) : string
$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.
Результат string attachment CID.

embedContent() публичный Метод

This method should be used when embedding images or other data in a message.
public embedContent ( string $content, array $options = [] ) : string
$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.
Результат string attachment CID.

getBcc() публичный Метод

Returns the Bcc (hidden copy receiver) addresses of this message.
public getBcc ( ) : array
Результат array the Bcc (hidden copy receiver) addresses of this message.

getCc() публичный Метод

Returns the Cc (additional copy receiver) addresses of this message.
public getCc ( ) : array
Результат array the Cc (additional copy receiver) addresses of this message.

getCharset() публичный Метод

Returns the character set of this message.
public getCharset ( ) : string
Результат string the character set of this message.

getFrom() публичный Метод

Returns the message sender.
public getFrom ( ) : string
Результат string the sender

getReplyTo() публичный Метод

Returns the reply-to address of this message.
public getReplyTo ( ) : string
Результат string the reply-to address of this message.

getSubject() публичный Метод

Returns the message subject.
public getSubject ( ) : string
Результат string the message subject

getTo() публичный Метод

Returns the message recipient(s).
public getTo ( ) : array
Результат array the message recipients

send() публичный Метод

Sends this email message.
public send ( yii\mail\MailerInterface $mailer = null ) : boolean
$mailer yii\mail\MailerInterface the mailer that should be used to send this message. If null, the "mail" application component will be used instead.
Результат boolean whether this message is sent successfully.

setBcc() публичный Метод

Sets the Bcc (hidden copy receiver) addresses of this message.
public setBcc ( string | array $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]`.

setCc() публичный Метод

Sets the Cc (additional copy receiver) addresses of this message.
public setCc ( string | array $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]`.

setCharset() публичный Метод

Sets the character set of this message.
public setCharset ( string $charset )
$charset string character set name.

setFrom() публичный Метод

Sets the message sender.
public setFrom ( string | array $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]`.

setHtmlBody() публичный Метод

Sets message HTML content.
public setHtmlBody ( string $html )
$html string message HTML content.

setReplyTo() публичный Метод

Sets the reply-to address of this message.
public setReplyTo ( string | array $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]`.

setSubject() публичный Метод

Sets the message subject.
public setSubject ( string $subject )
$subject string message subject

setTextBody() публичный Метод

Sets message plain text content.
public setTextBody ( string $text )
$text string message plain text content.

setTo() публичный Метод

Sets the message recipient(s).
public setTo ( string | array $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]`.

toString() публичный Метод

Returns string representation of this message.
public toString ( ) : string
Результат string the string representation of this message.