Commit 5cbf6e57ac6cb33e5fef866e0e4f9914f6b8f9cb
1 parent
4bf42036
-Mail dances
Showing
2 changed files
with
8 additions
and
6 deletions
Show diff stats
common/widgets/Mailer.php
@@ -25,11 +25,11 @@ class Mailer extends Widget{ | @@ -25,11 +25,11 @@ class Mailer extends Widget{ | ||
25 | 25 | ||
26 | $mail->IsSMTP(); | 26 | $mail->IsSMTP(); |
27 | $mail->CharSet = 'UTF-8'; | 27 | $mail->CharSet = 'UTF-8'; |
28 | -// $mail->SMTPDebug = 2; | 28 | + $mail->SMTPDebug = 2; |
29 | $mail->SMTPAuth = true; | 29 | $mail->SMTPAuth = true; |
30 | - $mail->SMTPSecure = 'ssl'; | 30 | + $mail->SMTPSecure = 'tls'; |
31 | $mail->Host = "smtp.gmail.com"; | 31 | $mail->Host = "smtp.gmail.com"; |
32 | - $mail->Port = 465; // 465 or 587 | 32 | + $mail->Port = 587; // 465 or 587 |
33 | $mail->Username = "nissanleaf17@gmail.com"; // Google email account | 33 | $mail->Username = "nissanleaf17@gmail.com"; // Google email account |
34 | $mail->Password = "parol123"; // Password to this account | 34 | $mail->Password = "parol123"; // Password to this account |
35 | $mail->SetFrom("leaf@electrocars.ua"); | 35 | $mail->SetFrom("leaf@electrocars.ua"); |
@@ -37,7 +37,7 @@ class Mailer extends Widget{ | @@ -37,7 +37,7 @@ class Mailer extends Widget{ | ||
37 | $mail->Subject = $this->subject; | 37 | $mail->Subject = $this->subject; |
38 | $mail->Body = $this->render($this->type, ['params' => $this->params]); | 38 | $mail->Body = $this->render($this->type, ['params' => $this->params]); |
39 | $mail->AddAddress('kennen.md@gmail.com'); | 39 | $mail->AddAddress('kennen.md@gmail.com'); |
40 | -// $mail->AddAddress('pmartweb1@gmail.com'); | 40 | + $mail->AddAddress('pmartweb1@gmail.com'); |
41 | if(!$mail->Send()) { | 41 | if(!$mail->Send()) { |
42 | echo "Mailer Error: " . $mail->ErrorInfo; | 42 | echo "Mailer Error: " . $mail->ErrorInfo; |
43 | } else { | 43 | } else { |
frontend/controllers/SiteController.php
@@ -87,11 +87,12 @@ | @@ -87,11 +87,12 @@ | ||
87 | $years = Car::find() | 87 | $years = Car::find() |
88 | ->distinct() | 88 | ->distinct() |
89 | ->select('year') | 89 | ->select('year') |
90 | + ->orderBy('year') | ||
90 | ->asArray() | 91 | ->asArray() |
91 | ->column(); | 92 | ->column(); |
92 | $models = Car::find() | 93 | $models = Car::find() |
93 | ->distinct() | 94 | ->distinct() |
94 | - ->select('model') | 95 | + ->select('model')->orderBy('year') |
95 | ->asArray() | 96 | ->asArray() |
96 | ->column(); | 97 | ->column(); |
97 | if(\Yii::$app->request->isPost) { | 98 | if(\Yii::$app->request->isPost) { |
@@ -248,7 +249,7 @@ | @@ -248,7 +249,7 @@ | ||
248 | public function actionTestdrive() | 249 | public function actionTestdrive() |
249 | { | 250 | { |
250 | \Yii::$app->response->format = Response::FORMAT_JSON; | 251 | \Yii::$app->response->format = Response::FORMAT_JSON; |
251 | - Mailer::widget([ 'type' => 'test', | 252 | + $message = Mailer::widget([ 'type' => 'test', |
252 | 'subject' => 'Запись на тест-драйв', | 253 | 'subject' => 'Запись на тест-драйв', |
253 | 'params' => Yii::$app->request->post('TestdriveForm'), | 254 | 'params' => Yii::$app->request->post('TestdriveForm'), |
254 | ]); | 255 | ]); |
@@ -258,6 +259,7 @@ | @@ -258,6 +259,7 @@ | ||
258 | if ($model->save()) { | 259 | if ($model->save()) { |
259 | return [ | 260 | return [ |
260 | 'success' => true, | 261 | 'success' => true, |
262 | + 'message' => $message, | ||
261 | ]; | 263 | ]; |
262 | } | 264 | } |
263 | } | 265 | } |