Jump to content
Sign in to follow this  
btsyupilo

Ошибка отправки письма

Recommended Posts

Здравствуйте.

Есть форма обратной связи на странице с контактами. При отправке данной формы получаю следующую ошибку:
 

Notice: Undefined index: message in /home/*host*/*domain.ru*/storage/modification/catalog/controller/information/contact.php on line 24
Fatal error: Uncaught Exception: Error: E-Mail message required! in /home/*host*/*domain.ru*/docs/system/library/mail.php:135 Stack trace: #0 /home/*host*/*domain.ru*/storage/modification/catalog/controller/information/contact.php(25): Mail->send() #1 /home/*host*/*domain.ru*/storage/modification/system/engine/action.php(79): ControllerInformationContact->index() #2 /home/*host*/*domain.ru*/docs/system/engine/router.php(67): Action->execute(Object(Registry)) #3 /home/*host*/*domain.ru*/docs/system/engine/router.php(56): Router->execute(Object(Action)) #4 /home/*host*/*domain.ru*/docs/system/framework.php(168): Router->dispatch(Object(Action), Object(Action)) #5 /home/*host*/*domain.ru*/docs/system/startup.php(104): require_once('/home/bazisener...') #6 /home/*host*/*domain.ru*/docs/index.php(19): start('catalog') #7 {main} thrown in /home/*host*/*domain.ru*/docs/system/library/mail.php on line 135

При этом остальные формы на других страницах и в модальных окнах работают корректно, выдавая сообщение об успешной отправке.

Отрывок кода из файла contact.php
 

		if (($this->request->server['REQUEST_METHOD'] == 'POST')) {
			$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->setReplyTo($this->request->post['email']);
			$mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
			$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
			$mail->setText($this->request->post['message']);
			$mail->send();

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


Отрывок кода из файла mail.php
 

		if ((!$this->text) && (!$this->html)) {
			throw new \Exception('Error: E-Mail message required!');
		}


В чем может быть проблема и как решить данную проблему?
Версия Opencart 3.0.2.0.

Share this post


Link to post
Share on other sites

нет поля message наверное.

в дефолтном шаблоне поле называется enquiry, значит нужно

$mail->setText($this->request->post['enquiry']);

в стандартном контроллере так и есть, видимо какой-то кривой модификатор "исправил" вам отправку

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.