@@ -104,4 +104,17 @@ class ContactForm extends Model | |||
); | |||
} | |||
public function sendEmailAdmin() | |||
{ | |||
return Yii::$app->mailerService->sendAdmin( | |||
'Contact : ' . $this->subject, | |||
'contact', | |||
[ | |||
'content' => $this->body, | |||
'name' => $this->name | |||
], | |||
$this->email | |||
); | |||
} | |||
} |
@@ -300,7 +300,7 @@ class SiteController extends FrontendController | |||
$model = new ContactForm(); | |||
$messageSent = false; | |||
if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |||
$model->sendEmail(Yii::$app->parameterBag->get('adminEmail')); | |||
$model->sendEmailAdmin(); | |||
$messageSent = true; | |||
} | |||