Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.96 KB | None | 0 0
  1. public function send() {
  2.         $this->language->load('catalog/subscribe');
  3.  
  4.         $this->load->model('catalog/subscribe');
  5.  
  6.         $subscribers = $this->model_catalog_subscribe->getSubscribers();
  7.         $sub_emails = array();
  8.         if ($this->validateSendMail($subscribers)) {
  9.             foreach ($subscribers as $subscriber) {
  10.                 if ($subscriber['status']=='1') {
  11.                     $subscribe_descriptions = $this->model_catalog_subscribe->getEmailDescription();
  12.                     $text_mail = $subscribe_descriptions[(int) $this->config->get('config_language_id')];
  13.                     $subject = sprintf($this->language->get('text_subject_mail'), $this->config->get('config_name'));
  14.  
  15.                     $message = '<html dir="ltr" lang="en">' . "\n";
  16.                     $message .= '  <head>' . "\n";
  17.                     $message .= '    <title>' . $subject . '</title>' . "\n";
  18.                     $message .= '    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' . "\n";
  19.                     $message .= '  </head>' . "\n";
  20.                     $message .= '  <body>' . html_entity_decode($text_mail, ENT_QUOTES, 'UTF-8') . '</body>' . "\n";
  21.                     $message .= '</html>' . "\n";
  22.  
  23.                     $mail = new Mail();
  24.                     $mail->protocol = $this->config->get('config_mail_protocol');
  25.                     $mail->parameter = $this->config->get('config_mail_parameter');
  26.                     $mail->hostname = $this->config->get('config_smtp_host');
  27.                     $mail->username = $this->config->get('config_smtp_username');
  28.                     $mail->password = $this->config->get('config_smtp_password');
  29.                     $mail->port = $this->config->get('config_smtp_port');
  30.                     $mail->timeout = $this->config->get('config_smtp_timeout');
  31.                     $mail->setTo($subscriber['email']);
  32.                     $mail->setFrom($this->config->get('config_email'));
  33.                     $mail->setSender($this->config->get('config_name'));
  34.                     $mail->setSubject($subject);
  35.                     $mail->setHtml($message); //FIXME volkov: уходит в рекурсию
  36.                     $mail->send();
  37.  
  38.                     $this->session->data['success'] = $this->language->get('text_send_success');
  39.                 }
  40.             }
  41.             var_dump($sub_emails);
  42.         }
  43.  
  44.         $this->getList();
  45.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement