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('adminlte', 'Thank you for contacting us. We will respond to you as soon as possible.')); } else { Yii::$app->session->setFlash('error', yii::t('adminlte', 'There was an error sending email.')); } return $this->refresh(); } else { return $this->render('contact', ['model' => $model]); } }