A mailer should mainly support creating and sending [[MessageInterface|mail messages]]. It should also support composition of the message body through the view rendering mechanism. For example, php Yii::$app->mailer->compose('contact/html', ['contactForm' => $form]) ->setFrom('from@domain.com') ->setTo($form->email) ->setSubject($form->subject) ->send();
또한 보기: MessageInterface
부터: 2.0
저자: Paul Klimov (klimov.paul@gmail.com)
예제 #1
0
 /**
  * Send email logic.
  *
  * @param MailerInterface $mailer
  * @param array $address
  */
 protected function sendEmail(MailerInterface $mailer, $address)
 {
     $message = $mailer->compose();
     $message->setTextBody(file_get_contents($this->_output))->setSubject($this->getEmailSubject())->setTo($address);
     $message->send();
 }
예제 #2
0
 /**
  * E-mail the output of the event to the recipients.
  *
  * @param MailerInterface $mailer
  * @param  array $addresses
  */
 protected function emailOutput(MailerInterface $mailer, $addresses)
 {
     $mailer->compose()->setTextBody(file_get_contents($this->_output))->setSubject($this->getEmailSubject())->setTo($addresses)->send();
 }
예제 #3
0
 /**
  * E-mail the output of the event to the recipients.
  *
  * @param MailerInterface $mailer
  * @param  array $addresses
  */
 protected function emailOutput(MailerInterface $mailer, $addresses)
 {
     $textBody = file_get_contents($this->_output);
     if (trim($textBody) != '') {
         $mailer->compose()->setTextBody($textBody)->setSubject($this->getEmailSubject())->setFrom($this->_fromAddress)->setTo($addresses)->send();
     }
 }