|
|
@ -9,6 +9,19 @@ namespace yii\mail; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* MessageInterface is an interface, which email message should apply. |
|
|
|
* MessageInterface is an interface, which email message should apply. |
|
|
|
|
|
|
|
* Together with application component, which matches the [[MailerInterface]], |
|
|
|
|
|
|
|
* it introduces following mail sending syntax: |
|
|
|
|
|
|
|
* ~~~php |
|
|
|
|
|
|
|
* Yii::$app->mail->createMessage() |
|
|
|
|
|
|
|
* ->setFrom('from@domain.com') |
|
|
|
|
|
|
|
* ->setTo('to@domain.com') |
|
|
|
|
|
|
|
* ->setSubject('Message Subject') |
|
|
|
|
|
|
|
* ->renderText('text/view') |
|
|
|
|
|
|
|
* ->renderHtml('html/view') |
|
|
|
|
|
|
|
* ->send(); |
|
|
|
|
|
|
|
* ~~~ |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see MailerInterface |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Paul Klimov <klimov.paul@gmail.com> |
|
|
|
* @author Paul Klimov <klimov.paul@gmail.com> |
|
|
|
* @since 2.0 |
|
|
|
* @since 2.0 |
|
|
@ -18,6 +31,7 @@ interface MessageInterface |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the character set of this message. |
|
|
|
* Set the character set of this message. |
|
|
|
* @param string $charset character set name. |
|
|
|
* @param string $charset character set name. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setCharset($charset); |
|
|
|
public function setCharset($charset); |
|
|
|
|
|
|
|
|
|
|
@ -27,6 +41,7 @@ interface MessageInterface |
|
|
|
* You may pass an array of addresses if this message is from multiple people. |
|
|
|
* 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: |
|
|
|
* You may also specify sender name in addition to email address using format: |
|
|
|
* [email => name]. |
|
|
|
* [email => name]. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setFrom($from); |
|
|
|
public function setFrom($from); |
|
|
|
|
|
|
|
|
|
|
@ -36,6 +51,7 @@ interface MessageInterface |
|
|
|
* You may pass an array of addresses if multiple recipients should receive this message. |
|
|
|
* 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: |
|
|
|
* You may also specify receiver name in addition to email address using format: |
|
|
|
* [email => name]. |
|
|
|
* [email => name]. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setTo($to); |
|
|
|
public function setTo($to); |
|
|
|
|
|
|
|
|
|
|
@ -45,6 +61,7 @@ interface MessageInterface |
|
|
|
* You may pass an array of addresses if multiple recipients should receive this message. |
|
|
|
* 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: |
|
|
|
* You may also specify receiver name in addition to email address using format: |
|
|
|
* [email => name]. |
|
|
|
* [email => name]. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setCc($cc); |
|
|
|
public function setCc($cc); |
|
|
|
|
|
|
|
|
|
|
@ -54,24 +71,28 @@ interface MessageInterface |
|
|
|
* You may pass an array of addresses if multiple recipients should receive this message. |
|
|
|
* 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: |
|
|
|
* You may also specify receiver name in addition to email address using format: |
|
|
|
* [email => name]. |
|
|
|
* [email => name]. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setBcc($bcc); |
|
|
|
public function setBcc($bcc); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets message subject. |
|
|
|
* Sets message subject. |
|
|
|
* @param string $subject message subject |
|
|
|
* @param string $subject message subject |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setSubject($subject); |
|
|
|
public function setSubject($subject); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets message plain text content. |
|
|
|
* Sets message plain text content. |
|
|
|
* @param string $text message plain text content. |
|
|
|
* @param string $text message plain text content. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setText($text); |
|
|
|
public function setText($text); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets message HTML content. |
|
|
|
* Sets message HTML content. |
|
|
|
* @param string $html message HTML content. |
|
|
|
* @param string $html message HTML content. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function setHtml($html); |
|
|
|
public function setHtml($html); |
|
|
|
|
|
|
|
|
|
|
@ -81,6 +102,7 @@ interface MessageInterface |
|
|
|
* @param array $options options for embed file. Valid options are: |
|
|
|
* @param array $options options for embed file. Valid options are: |
|
|
|
* - fileName: name, which should be used to attach file. |
|
|
|
* - fileName: name, which should be used to attach file. |
|
|
|
* - contentType: attached file MIME type. |
|
|
|
* - contentType: attached file MIME type. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function attachContent($content, array $options = []); |
|
|
|
public function attachContent($content, array $options = []); |
|
|
|
|
|
|
|
|
|
|
@ -90,6 +112,7 @@ interface MessageInterface |
|
|
|
* @param array $options options for embed file. Valid options are: |
|
|
|
* @param array $options options for embed file. Valid options are: |
|
|
|
* - fileName: name, which should be used to attach file. |
|
|
|
* - fileName: name, which should be used to attach file. |
|
|
|
* - contentType: attached file MIME type. |
|
|
|
* - contentType: attached file MIME type. |
|
|
|
|
|
|
|
* @return static self reference. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function attachFile($fileName, array $options = []); |
|
|
|
public function attachFile($fileName, array $options = []); |
|
|
|
|
|
|
|
|
|
|
|