load->language('tool/upload'); $json = array(); $json['error'] = []; if($this->request->post['product_id']){ $this->load->model('catalog/product'); $data['product_info'] = $this->model_catalog_product->getProduct($this->request->post['product_id']); } $data['config_name'] = $this->config->get('config_name'); $data['post'] = $this->request->post; $message = $this->load->view('mail/request', $data); $this->sendTG($message); $mail = new Mail($this->config->get('config_mail_engine')); $mail->parameter = $this->config->get('config_mail_parameter'); $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); $mail->smtp_username = $this->config->get('config_mail_smtp_username'); $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); $mail->smtp_port = $this->config->get('config_mail_smtp_port'); $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); $mail->setTo($this->config->get('config_email')); $mail->setFrom($this->config->get('config_email')); $mail->setSender($this->config->get('config_name')); $mail->setSubject('Новая заявка'); $mail->setHtml($message); $mail->send(); if($this->config->get('config_mail_alert_email')){ foreach(explode(",", $this->config->get('config_mail_alert_email')) as $email){ $mail->setTo(trim($email)); $mail->send(); } } $json['success'] = true; $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } private function sendTG($message){ $message = str_replace(['