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