當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ContactForm::sendEmail方法代碼示例

本文整理匯總了PHP中ContactForm::sendEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContactForm::sendEmail方法的具體用法?PHP ContactForm::sendEmail怎麽用?PHP ContactForm::sendEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ContactForm的用法示例。


在下文中一共展示了ContactForm::sendEmail方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionContact

 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
         } else {
             Yii::$app->session->setFlash('error', 'There was an error sending email.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:yelmeneray,項目名稱:teknolojihaber,代碼行數:19,代碼來源:SiteController.php

示例2: actionContact

 public function actionContact($id)
 {
     $contactform = new ContactForm();
     $model = $this->loadModel($id);
     if ($model->status == 'complete') {
         Yii::app()->user->setFlash('error', 'Sorry, this posting is complete and you can no longer contact the seller.');
         $this->redirect(array('/post/view', 'id' => $model->id));
     }
     if (isset($_POST['ContactForm'])) {
         $contactform->attributes = $_POST['ContactForm'];
         if ($contactform->validate()) {
             if ($contactform->sendEmail($model)) {
                 Yii::app()->user->setFlash('success', 'Email sent successfully.');
                 $this->redirect(array('/post/view', 'id' => $model->id));
             } else {
                 Yii::app()->user->setFlash('error', 'Error sending email. Please contact us.');
             }
         } else {
             $contactform->verifyCode = '';
         }
     }
     $this->render('contact', array('model' => $model, 'contactform' => $contactform));
 }
開發者ID:narwold,項目名稱:Small-Potatoes,代碼行數:23,代碼來源:PostController.php

示例3: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Ваше сообщение отправлено. В ближайшее время мы свяжемся с Вами.');
         } else {
             Yii::$app->session->setFlash('error', 'Произошла ошибка при отправке.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:babagay,項目名稱:razzd,代碼行數:14,代碼來源:SiteController.php


注:本文中的ContactForm::sendEmail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。