K
K
kazimirov_art2022-01-30 12:07:17
PHP
kazimirov_art, 2022-01-30 12:07:17

Feedback on OpenCart is not adjusted so that messages leave the administrator?

Hello, yesterday I spent the whole day fiddling with feedback, I don’t understand what the problem is, I reviewed the entire Internet, set everything up correctly, but the return on feedback is different.
The question is that there is a standard output of feedback to the contacts section, from there the person fills in the data (name, email and message), and the data that comes to the administrator by email in "from" is indicated his mail that he entered when filling out the form, but this is essentially phishing, but the essence is that because of this message, if a user entered mail with the mail.ru domain, they do not come because of their policy, I will show part of the code from the /catalog/controller/information/contact.php file, maybe there is something this is not so, but the entire Internet says that this is the correct code so that messages come from the admin, and not from the user's mail, and also cleared the modifier cache

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
      $mail = new Mail();
      $mail->protocol = $this->config->get('config_mail_protocol');
      $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(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
            $mail->setReplyTo($this->request->post['email']);
  			$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
      $message = '<p>Имя: '.$this->request->post['name'].'</p>';//добавляем имя
            $message .= '<p>Email: '.$this->request->post['email'].'</p>';//добавляем email
            $message .= '<p>Cообщение: '.$this->request->post['enquiry'].'</p>';// и сообщение
            $mail->setHtml($message);
      $mail->send();

      $this->response->redirect($this->url->link('information/contact/success'));
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question