当前位置: 首页>>代码示例>>PHP>>正文


PHP ContactForm::sendEmail方法代码示例

本文整理汇总了PHP中app\models\ContactForm::sendEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm::sendEmail方法的具体用法?PHP ContactForm::sendEmail怎么用?PHP ContactForm::sendEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\ContactForm的用法示例。


在下文中一共展示了ContactForm::sendEmail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionContact

 /**
  * Renders the contact page
  * @return string
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->sendEmail(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:Quexer69,项目名称:app,代码行数:14,代码来源:SiteController.php

示例2: actionContact

 /**
  * @param null|\app\core\admpages\models\Page $modelPage
  * @return string|\yii\web\Response
  */
 public function actionContact($modelPage = null)
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail()) {
             Yii::$app->session->setFlash('success', Yii::t("app/contacts", "Thank you for contacting us. We will respond to you as soon as possible.", ['dot' => false]));
             return $this->refresh();
         }
         Yii::$app->session->setFlash('error', Yii::t("app/contacts", "There was an error sending email.", ['dot' => false]));
     }
     return $this->render('contact', ['model' => $model, 'modelPage' => $modelPage]);
 }
开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:16,代码来源:PagesController.php

示例3: 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:nanodirijabl,项目名称:garrulous-meow,代码行数:19,代码来源:SiteController.php

示例4: 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:hehbhehb,项目名称:hongsong,代码行数:14,代码来源:SiteController.php

示例5: 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', 'Dank u voor uw bericht. Wij zullen zo spoedig mogelijk contact met u opnemen.');
         } else {
             Yii::$app->session->setFlash('error', 'Er ging iets fout met het versturen');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model, 'page' => 'page-contact']);
     }
     //return $this->render('contact', ['page' => 'page-contact']);
 }
开发者ID:amavis442,项目名称:vpjuristen,代码行数:15,代码来源:SiteController.php

示例6: testContact

 public function testContact()
 {
     $model = new ContactForm();
     $model->attributes = ['name' => 'Tester', 'email' => 'tester@example.com', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
     $model->sendEmail('admin@example.com');
     $this->specify('email should be send', function () {
         expect('email file should exist', file_exists($this->getMessageFile()))->true();
     });
     $this->specify('message should contain correct data', function () use($model) {
         $emailMessage = file_get_contents($this->getMessageFile());
         expect('email should contain user name', $emailMessage)->contains($model->name);
         expect('email should contain sender email', $emailMessage)->contains($model->email);
         expect('email should contain subject', $emailMessage)->contains($model->subject);
         expect('email should contain body', $emailMessage)->contains($model->body);
     });
 }
开发者ID:Humanized,项目名称:viajero,代码行数:16,代码来源:ContactFormTest.php


注:本文中的app\models\ContactForm::sendEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。