send() public method

Функция отправки сообщения:
public send ( string $from, string | array $to, string $theme, string $body, boolean $isText = false, array $replyTo = [] ) : boolean
$from string - адрес отправителя
$to string | array - адрес(-а) получателя
$theme string - тема письма
$body string - тело письма
$isText boolean - является ли тело письма текстом
$replyTo array добавляет заголовок Reply-To, формат [email => имя]
return boolean отправилось ли письмо
Exemplo n.º 1
0
 /**
  * @param IFeedbackForm $form
  * @param FeedBack|null $feedBack
  * @return bool
  */
 public function sendConfirmation(IFeedbackForm $form, FeedBack $feedBack = null)
 {
     $emailBody = Yii::app()->controller->renderPartial('feedbackConfirmationEmail', ['model' => $feedBack], true);
     $result = $this->mail->send($this->module->notifyEmailFrom, $form->getEmail(), Yii::t('FeedbackModule.feedback', 'Your proposition on site "{site}" was received', ['{site}' => Yii::app()->name]), $emailBody);
     if ($result) {
         Yii::log(Yii::t('FeedbackModule.feedback', 'Feedback: Notification for user was sent to email successfully'), CLogger::LEVEL_INFO, FeedbackModule::$logCategory);
     } else {
         Yii::log(Yii::t('FeedbackModule.feedback', 'Feedback: can\'t send message'), CLogger::LEVEL_INFO, FeedbackModule::$logCategory);
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * @param IFeedbackForm $form
  * @param FeedBack|null $feedBack
  * @return bool
  */
 public function sendConfirmation(IFeedbackForm $form, FeedBack $feedBack = null)
 {
     $emailBody = Yii::app()->getController()->renderPartial('feedbackConfirmationEmail', ['model' => $feedBack], true);
     return $this->mail->send($this->module->notifyEmailFrom, $form->getEmail(), Yii::t('FeedbackModule.feedback', 'Your proposition on site "{site}" was received', ['{site}' => Yii::app()->name]), $emailBody);
     return $result;
 }