diff --git a/src/app/frontend/controllers/MenuController.php b/src/app/frontend/controllers/MenuController.php index c29966a..79d216c 100644 --- a/src/app/frontend/controllers/MenuController.php +++ b/src/app/frontend/controllers/MenuController.php @@ -1263,7 +1263,7 @@ class MenuController extends \controllers\ControllerBase $check = $this->models->getSubscribe()->getOneDataByEmail($data['email']); if( empty($check) && $this->models->getSubscribe()->addData($data) ) { - $this->sendmail->addCustomer( 10, $data ); + $this->sendmail->sendSubscribe( $data ); setcookie("popup", '1', time()+3600, '/'); diff --git a/src/lib/sendmail.php b/src/lib/sendmail.php index 01d1377..b2e06d7 100644 --- a/src/lib/sendmail.php +++ b/src/lib/sendmail.php @@ -224,6 +224,60 @@ namespace } ///////////////////////////////////////////////////////////////////////////// + + public function sendSubscribe($data) { + $view = new \Phalcon\Mvc\View(); + $view->setViewsDir( ROOT_PATH.config::get( 'dirs/viewsDir' ) ); + + $view->start(); + + $view->setVar( 'data', $data ); + $view->render( 'sendmail', 'message_10' ); + + $view->finish(); + $message_body = $view->getContent(); + + $mail = new PHPMailer; + //Tell PHPMailer to use SMTP + $mail->isSMTP(); + //Enable SMTP debugging + // 0 = off (for production use) + // 1 = client messages + // 2 = client and server messages + $mail->SMTPDebug = 0; + //Ask for HTML-friendly debug output + $mail->Debugoutput = 'html'; + //Set the hostname of the mail server + $mail->Host = 'smtp.gmail.com'; + $mail->CharSet = 'UTF-8'; + // use + // $mail->Host = gethostbyname('smtp.gmail.com'); + // if your network does not support SMTP over IPv6 + //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission + $mail->Port = 587; + //Set the encryption system to use - ssl (deprecated) or tls + $mail->SMTPSecure = 'tls'; + //Whether to use SMTP authentication + $mail->SMTPAuth = true; + //Username to use for SMTP authentication - use full email address for gmail + $mail->Username = "arctic.semenainua@gmail.com"; + //Password to use for SMTP authentication + $mail->Password = "arctic0411"; + + //Set who the message is to be sent from + $mail->setFrom('semena@hs.kiev.ua', 'semena.in.ua'); + //Set who the message is to be sent to + $mail->addAddress($data['email'], $data['name']); + //Set the subject line + $mail->Subject = 'Промокод на сайт semena.in.ua'; + //Read an HTML message body from an external file, convert referenced images to embedded, + //convert HTML into a basic plain-text alternative body + + $mail->msgHTML($message_body); + $mail->send(); + } + + ///////////////////////////////////////////////////////////////////////////// } } -- libgit2 0.21.4