Commit 7af1c1f46de684f5def852d2da21910b61323981
1 parent
5cbf6e57
-Mail and Map
Showing
2 changed files
with
61 additions
and
47 deletions
Show diff stats
common/widgets/Mailer.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\widgets; | |
4 | - | |
5 | -use yii\base\Widget; | |
6 | - | |
7 | -class Mailer extends Widget{ | |
8 | - public $message; | |
9 | - public $email; | |
10 | - public $text; | |
11 | - public $subject; | |
12 | - public $type; | |
13 | - public $params; | |
14 | - | |
15 | - | |
16 | - public function init(){ | |
17 | - | |
18 | - parent::init(); | |
19 | - | |
20 | - } | |
21 | - | |
22 | - public function run(){ | |
23 | - | |
24 | - $mail = new \PHPMailer(); | |
25 | 2 | |
26 | - $mail->IsSMTP(); | |
27 | - $mail->CharSet = 'UTF-8'; | |
28 | - $mail->SMTPDebug = 2; | |
29 | - $mail->SMTPAuth = true; | |
30 | - $mail->SMTPSecure = 'tls'; | |
31 | - $mail->Host = "smtp.gmail.com"; | |
32 | - $mail->Port = 587; // 465 or 587 | |
33 | - $mail->Username = "nissanleaf17@gmail.com"; // Google email account | |
34 | - $mail->Password = "parol123"; // Password to this account | |
35 | - $mail->SetFrom("leaf@electrocars.ua"); | |
36 | - $mail->isHTML(true); | |
37 | - $mail->Subject = $this->subject; | |
38 | - $mail->Body = $this->render($this->type, ['params' => $this->params]); | |
39 | - $mail->AddAddress('kennen.md@gmail.com'); | |
40 | - $mail->AddAddress('pmartweb1@gmail.com'); | |
41 | - if(!$mail->Send()) { | |
42 | - echo "Mailer Error: " . $mail->ErrorInfo; | |
43 | - } else { | |
44 | - echo "Message has been sent"; | |
3 | + namespace common\widgets; | |
4 | + | |
5 | + use yii\base\Widget; | |
6 | + | |
7 | + class Mailer extends Widget | |
8 | + { | |
9 | + public $message; | |
10 | + public $email; | |
11 | + public $text; | |
12 | + public $subject; | |
13 | + public $type; | |
14 | + public $params; | |
15 | + | |
16 | + public function init() | |
17 | + { | |
18 | + | |
19 | + parent::init(); | |
20 | + | |
21 | + } | |
22 | + | |
23 | + public function run() | |
24 | + { | |
25 | + $headers = "MIME-Version: 1.0\r\n"; | |
26 | + $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; | |
27 | + if (mail( | |
28 | + 'leaf@electrocars.ua', | |
29 | + $this->subject, | |
30 | + $this->render($this->type, [ 'params' => $this->params ]), | |
31 | + $headers | |
32 | + )) { | |
33 | + echo 'ok'; | |
34 | + } else { | |
35 | + echo 'fail'; | |
36 | + } | |
37 | + | |
38 | + // $mail = new \PHPMailer(); | |
39 | + // | |
40 | + // $mail->IsSMTP(); | |
41 | + // $mail->CharSet = 'UTF-8'; | |
42 | + // $mail->SMTPDebug = 2; | |
43 | + // $mail->SMTPAuth = true; | |
44 | + // $mail->SMTPSecure = 'tls'; | |
45 | + // $mail->Host = "smtp.gmail.com"; | |
46 | + // $mail->Port = 587; // 465 or 587 | |
47 | + // $mail->Username = "kennen.md@gmail.com"; // Google email account | |
48 | + // $mail->Password = "nobeernoparty"; // Password to this account | |
49 | + // $mail->SetFrom("leaf@electrocars.ua"); | |
50 | + // $mail->isHTML(true); | |
51 | + // $mail->Subject = $this->subject; | |
52 | + // $mail->Body = $this->render($this->type, ['params' => $this->params]); | |
53 | + // $mail->AddAddress('kennen.md@gmail.com'); | |
54 | + //// $mail->AddAddress('pmartweb1@gmail.com'); | |
55 | + // if(!$mail->Send()) { | |
56 | + // echo "Mailer Error: " . $mail->ErrorInfo; | |
57 | + // } else { | |
58 | + // echo "Message has been sent"; | |
59 | + // } | |
45 | 60 | } |
61 | + | |
46 | 62 | } |
47 | 63 | |
48 | -} | |
49 | - | ... | ... |
frontend/views/site/index.php
... | ... | @@ -496,12 +496,12 @@ |
496 | 496 | <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA_0T2bU2ZE-8ltMdy0h-HT-kgwF67bD5c&callback=initMap"></script> |
497 | 497 | <script type="text/javascript"> |
498 | 498 | var map; |
499 | - var posLat = 50.489539; | |
500 | - var poslng = 30.479169; | |
499 | + var posLat = 50.4890503; | |
500 | + var poslng = 30.4737441; | |
501 | 501 | function initMap() { |
502 | 502 | map = new google.maps.Map(document.getElementById('map'), { |
503 | 503 | center: {lat: posLat, lng: poslng}, |
504 | - zoom: 18, | |
504 | + zoom: 17, | |
505 | 505 | scrollwheel: false |
506 | 506 | // draggable:false |
507 | 507 | ... | ... |