Commit 6f032403861b4dfbc6405ef94660407adeb174f0

Authored by Alexey Boroda
1 parent f7b259ca

-Confirm mail ready

backend/controllers/RequestController.php
... ... @@ -10,6 +10,13 @@
10 10  
11 11 class RequestController extends Controller implements ControllerInterface
12 12 {
  13 + const LANGUAGES = [
  14 + 1 => 'en',
  15 + 2 => 'ru',
  16 + 3 => 'ua',
  17 + 4 => 'fr',
  18 + ];
  19 +
13 20 public function actions()
14 21 {
15 22 return [
... ... @@ -50,13 +57,13 @@
50 57  
51 58 $request = \Yii::$app->request;
52 59  
53   - $wasNew = (strval($model->status) === '2');
  60 + $wasNew = ( strval($model->status) === '2' );
54 61  
55 62 if ($request->isPost) {
56 63 if ($model->load($request->post()) && $model->save()) {
57 64  
58   - if ($wasNew && (strval($model->status) === '1' )) {
59   - $this->mail($model->email);
  65 + if ($wasNew && ( strval($model->status) === '1' )) {
  66 + $this->mail($model);
60 67 }
61 68  
62 69 return $this->redirect([ 'index' ]);
... ... @@ -114,7 +121,29 @@
114 121 }
115 122 }
116 123  
117   - public function mail($email) {
118   -
  124 + public function mail(Customer $model)
  125 + {
  126 + $subject = "CONFIRM__#" . $model->id . ': ' . $model->name;
  127 +
  128 + \Yii::$app->language = self::LANGUAGES[ intval($model->language_id) ];
  129 +
  130 + \Yii::$app->mailer->compose(
  131 + 'thanks_' . $model->language_id,
  132 + [
  133 + 'phone' => '+380732590821',
  134 + 'email' => 'energyforum@euromediacompany.com',
  135 + 'model' => $model,
  136 + ]
  137 + )
  138 + ->setFrom(
  139 + [
  140 + 'artboxcore@gmail.com' => 'NINTH INTERNATIONAL FORUM',
  141 + ]
  142 + )
  143 + ->setTo(
  144 + $model->email
  145 + )
  146 + ->setSubject($subject)
  147 + ->send();
119 148 }
120 149 }
121 150 \ No newline at end of file
... ...
frontend/controllers/SiteController.php
... ... @@ -242,10 +242,8 @@
242 242 ->setTo(
243 243 [
244 244 // 'kennen.md@gmail.com',
245   - 'kennen.md@gmail.com',
246   - 'kazimirova.artweb@gmail.com',
  245 +// 'kazimirova.artweb@gmail.com',
247 246 'energyforum@euromediacompany.com',
248   - 'alkhonko@gmail.com',
249 247 ]
250 248 )
251 249 ->setSubject($subject)
... ... @@ -253,7 +251,7 @@
253 251 ->send();
254 252  
255 253 \Yii::$app->mailer->compose(
256   - 'thanks_' . $model->language_id,
  254 + '_thanks_' . $model->language_id,
257 255 [
258 256 'phone' => '+380732590821',
259 257 'email' => 'energyforum@euromediacompany.com',
... ...