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


PHP ContactForm::sendEmail方法代碼示例

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


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

示例1: actionFeedback

 public function actionFeedback()
 {
     $model = new ContactForm();
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->settings->get('main.supportEmail'))) {
             return 'Спасибо за ваше сообщение, мы обязательно ответим вам в ближайшее время.';
         } else {
             return 'Что то пошло не так :( Попробуйте позднее';
         }
     }
     return 'Что то пошло не так :(';
 }
開發者ID:sergey-exu,項目名稱:goldex,代碼行數:12,代碼來源:SiteController.php

示例2: actionContact

 /**
  * Contact.
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $success = $model->sendEmail(\Yii::$app->params['adminEmail']);
         if ($success) {
             \Yii::$app->session->setFlash('success', 'Your message has been sent!');
             $this->refresh('#form');
         }
     }
     return $this->render('contact', ['model' => $model]);
 }
開發者ID:Krinnerion,項目名稱:shop,代碼行數:15,代碼來源:DefaultController.php

示例3: actionContact

 /**
  * Displays the contact static page and sends the contact email.
  *
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if (!$model->load(Yii::$app->request->post()) || !$model->validate()) {
         return $this->render('contact', ['model' => $model]);
     }
     if (!$model->sendEmail(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('error', Yii::t('app', 'There was some error while sending email.'));
         return $this->refresh();
     }
     Yii::$app->session->setFlash('success', Yii::t('app', 'Thank you for contacting us. We will respond to you as soon as possible.'));
     return $this->refresh();
 }
開發者ID:firdows,項目名稱:yii2-advanced-template,代碼行數:18,代碼來源:SiteController.php

示例4: 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', 'Спасибо за Ваше сообщение. Мы ответим вам при первой возможности.');
         } else {
             Yii::$app->session->setFlash('error', 'При отправке сообщения произошла ошибка.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:kvazarum,項目名稱:prereg,代碼行數:19,代碼來源:SiteController.php

示例5: 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', Yii::t('c/radiata/contact', 'Thank you'));
         } else {
             Yii::$app->session->setFlash('error', Yii::t('c/radiata/contact', 'Errors'));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:radiata-cms,項目名稱:radiata,代碼行數:19,代碼來源:SiteController.php

示例6: 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', ['type' => 'success', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'Thank you for contacting us. We will respond to you as soon as possible.', 'title' => 'Sending Message']);
         } else {
             Yii::$app->session->setFlash('error', ['type' => 'danger', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'There was an error sending email.', 'title' => 'Sending Message']);
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:ninjacto,項目名稱:ninjacto.com,代碼行數:19,代碼來源:SiteController.php

示例7: 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', 'Obrigado pelo seu contacto! Recebrá uma resposta brevemente.');
         } else {
             Yii::$app->session->setFlash('error', 'Ocorreu um erro ao enviar o email!');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:ceif,項目名稱:Autarquia-Livre,代碼行數:14,代碼來源:SiteController.php

示例8: actionIndex

 public function actionIndex()
 {
     $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->render('/order/thank');
     } else {
         return $this->render('index', ['model' => $model]);
     }
 }
開發者ID:uraankhayayaal,項目名稱:aic.s-vfu.ru,代碼行數:14,代碼來源:OrehController.php

示例9: 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:VitaliyProdan,項目名稱:hr,代碼行數:14,代碼來源:SiteController.php

示例10: actionContact

 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         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:sowanderr,項目名稱:mir,代碼行數:19,代碼來源:SiteController.php

示例11: 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->addFlash('success', Yii::t('frontend', 'Thank you for contacting us. We will respond to you as soon as possible.'));
         } else {
             Yii::$app->session->addFlash('error', Yii::t('frontend', 'There was an error sending email.'));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:WondersLabCorporation,項目名稱:yii2,代碼行數:19,代碼來源:SiteController.php

示例12: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail('himanshu53939@gmail.com')) {
             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:himanshu4tl,項目名稱:advanded,代碼行數:14,代碼來源:SiteController.php

示例13: testSendEmail

 public function testSendEmail()
 {
     $model = new ContactForm();
     $model->attributes = ['name' => 'Tester', 'email' => 'tester@example.com', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
     expect_that($model->sendEmail('admin@example.com'));
     // using Yii2 module actions to check email was sent
     $this->tester->seeEmailIsSent();
     $emailMessage = $this->tester->grabLastSentEmail();
     expect('valid email is sent', $emailMessage)->isInstanceOf('yii\\mail\\MessageInterface');
     expect($emailMessage->getTo())->hasKey('admin@example.com');
     expect($emailMessage->getFrom())->hasKey('tester@example.com');
     expect($emailMessage->getSubject())->equals('very important letter subject');
     expect($emailMessage->toString())->contains('body of current message');
 }
開發者ID:lanfp,項目名稱:testgit2,代碼行數:14,代碼來源:ContactFormTest.php

示例14: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail()) {
             Yii::$app->getSession()->setFlash('success', ['type' => 'success', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-envelope', 'message' => 'Muchas gracias por contactarnos. Le responderemos a la brevedad', 'title' => 'Contacto', 'positonY' => 'top', 'positonX' => 'center']);
             return $this->goHome();
         } else {
             Yii::$app->getSession()->setFlash('danger', ['type' => 'danger', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-exclamation-sign', 'message' => 'Ocurrió un error al enviar el mail. Por favor, comuníquese con info@remisesramallo.com.ar', 'title' => 'Contacto', 'positonY' => 'top', 'positonX' => 'center']);
             return $this->goHome();
         }
     } else {
         return $this->renderAjax('contact', ['model' => $model]);
     }
 }
開發者ID:vilariel,項目名稱:remisesramallo,代碼行數:15,代碼來源:HomeController.php

示例15: actionContact

 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $this->pageDescription = 'Если у вас есть деловое предложение или другие вопросы, пожалуйста, заполните форму на странице, чтобы связаться с нами.';
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['infoEmail'])) {
             Yii::$app->session->setFlash('success', 'Ваше сообщение было отправлено.<br/> Наши сотрудники в кратчайшее время свяжуться с Вами по электронной почте, которая была указана в форме. Благодарим Вас за обращение к нам.');
         } else {
             Yii::$app->session->setFlash('error', 'Oшибка отправки электронной почты.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
開發者ID:Alpha-Hydro,項目名稱:tc-alpha,代碼行數:20,代碼來源:SiteController.php


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