1: | <?php
2: | namespace Opencart\Catalog\Controller\Mail;
3: | /**
4: | * Class Forgotten
5: | *
6: | * @package Opencart\Catalog\Controller\Mail
7: | */
8: | class Forgotten extends \Opencart\System\Engine\Controller {
9: | // catalog/model/account/customer/editCode/after
10: | /**
11: | * @param string $route
12: | * @param array<int, mixed> $args
13: | * @param mixed $output
14: | *
15: | * @throws \Exception
16: | *
17: | * @return void
18: | */
19: | public function index(string &$route, array &$args, &$output): void {
20: | if ($args[0] && $args[1]) {
21: | $this->load->model('account/customer');
22: |
23: | $customer_info = $this->model_account_customer->getCustomerByEmail($args[0]);
24: |
25: | if ($customer_info) {
26: | $this->load->language('mail/forgotten');
27: |
28: | $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
29: |
30: | $subject = sprintf($this->language->get('text_subject'), $store_name);
31: |
32: | $data['text_greeting'] = sprintf($this->language->get('text_greeting'), $store_name);
33: |
34: | $data['reset'] = $this->url->link('account/forgotten.reset', 'language=' . $this->config->get('config_language') . '&email=' . urlencode($args[0]) . '&code=' . $args[1], true);
35: | $data['ip'] = $this->request->server['REMOTE_ADDR'];
36: |
37: | $data['store'] = $store_name;
38: | $data['store_url'] = $this->config->get('config_url');
39: |
40: | if ($this->config->get('config_mail_engine')) {
41: | $mail_option = [
42: | 'parameter' => $this->config->get('config_mail_parameter'),
43: | 'smtp_hostname' => $this->config->get('config_mail_smtp_hostname'),
44: | 'smtp_username' => $this->config->get('config_mail_smtp_username'),
45: | 'smtp_password' => html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'),
46: | 'smtp_port' => $this->config->get('config_mail_smtp_port'),
47: | 'smtp_timeout' => $this->config->get('config_mail_smtp_timeout')
48: | ];
49: |
50: | $mail = new \Opencart\System\Library\Mail($this->config->get('config_mail_engine'), $mail_option);
51: | $mail->setTo($args[0]);
52: | $mail->setFrom($this->config->get('config_email'));
53: | $mail->setSender($store_name);
54: | $mail->setSubject($subject);
55: | $mail->setHtml($this->load->view('mail/forgotten', $data));
56: | $mail->send();
57: | }
58: | }
59: | }
60: | }
61: | }
62: |

OpenCart API API documentation generated by ApiGen dev-master