From 5cbf6e57ac6cb33e5fef866e0e4f9914f6b8f9cb Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 30 Dec 2016 13:21:57 +0200 Subject: [PATCH] -Mail dances --- common/widgets/Mailer.php | 8 ++++---- frontend/controllers/SiteController.php | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/widgets/Mailer.php b/common/widgets/Mailer.php index d0f0ecd..098d002 100755 --- a/common/widgets/Mailer.php +++ b/common/widgets/Mailer.php @@ -25,11 +25,11 @@ class Mailer extends Widget{ $mail->IsSMTP(); $mail->CharSet = 'UTF-8'; -// $mail->SMTPDebug = 2; + $mail->SMTPDebug = 2; $mail->SMTPAuth = true; - $mail->SMTPSecure = 'ssl'; + $mail->SMTPSecure = 'tls'; $mail->Host = "smtp.gmail.com"; - $mail->Port = 465; // 465 or 587 + $mail->Port = 587; // 465 or 587 $mail->Username = "nissanleaf17@gmail.com"; // Google email account $mail->Password = "parol123"; // Password to this account $mail->SetFrom("leaf@electrocars.ua"); @@ -37,7 +37,7 @@ class Mailer extends Widget{ $mail->Subject = $this->subject; $mail->Body = $this->render($this->type, ['params' => $this->params]); $mail->AddAddress('kennen.md@gmail.com'); -// $mail->AddAddress('pmartweb1@gmail.com'); + $mail->AddAddress('pmartweb1@gmail.com'); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 9c35a94..13b95a6 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -87,11 +87,12 @@ $years = Car::find() ->distinct() ->select('year') + ->orderBy('year') ->asArray() ->column(); $models = Car::find() ->distinct() - ->select('model') + ->select('model')->orderBy('year') ->asArray() ->column(); if(\Yii::$app->request->isPost) { @@ -248,7 +249,7 @@ public function actionTestdrive() { \Yii::$app->response->format = Response::FORMAT_JSON; - Mailer::widget([ 'type' => 'test', + $message = Mailer::widget([ 'type' => 'test', 'subject' => 'Запись на тест-драйв', 'params' => Yii::$app->request->post('TestdriveForm'), ]); @@ -258,6 +259,7 @@ if ($model->save()) { return [ 'success' => true, + 'message' => $message, ]; } } -- libgit2 0.21.4