瀏覽代碼

[Site] Problème formulaire de contact

master
Guillaume Bourgeois 1 年之前
父節點
當前提交
7131100c41
共有 2 個檔案被更改,包括 14 行新增1 行删除
  1. +13
    -0
      common/forms/ContactForm.php
  2. +1
    -1
      frontend/controllers/SiteController.php

+ 13
- 0
common/forms/ContactForm.php 查看文件

@@ -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
);
}

}

+ 1
- 1
frontend/controllers/SiteController.php 查看文件

@@ -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;
}


Loading…
取消
儲存