transaction.php (1791B)
1 <?php 2 class ControllerMailTransaction extends Controller { 3 public function index(&$route, &$args, &$output) { 4 $this->load->language('mail/transaction'); 5 6 $this->load->model('account/customer'); 7 8 $customer_info = $this->model_account_customer->getCustomer($args[0]); 9 10 if ($customer_info) { 11 $data['text_received'] = sprintf($this->language->get('text_received'), $this->config->get('config_name')); 12 $data['text_amount'] = $this->language->get('text_amount'); 13 $data['text_total'] = $this->language->get('text_total'); 14 15 $data['amount'] = $this->currency->format($args[2], $this->config->get('config_currency')); 16 $data['total'] = $this->currency->format($this->model_account_customer->getTransactionTotal($args[0]), $this->config->get('config_currency')); 17 18 $mail = new Mail($this->config->get('config_mail_engine')); 19 $mail->parameter = $this->config->get('config_mail_parameter'); 20 $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); 21 $mail->smtp_username = $this->config->get('config_mail_smtp_username'); 22 $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); 23 $mail->smtp_port = $this->config->get('config_mail_smtp_port'); 24 $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); 25 26 $mail->setTo($customer_info['email']); 27 $mail->setFrom($this->config->get('config_email')); 28 $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')); 29 $mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), $this->config->get('config_name')), ENT_QUOTES, 'UTF-8')); 30 $mail->setText($this->load->view('mail/transaction', $data)); 31 $mail->send(); 32 } 33 } 34 } 35 36 37