Мож кому пригодится, я в модуле форм обратной связи у себя доработал отправку почты.
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->forms_array['title'] = $this->request->post['title'];
$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');
$email = $this->config->get('config_email');
if ($this->request->post['form']) {
foreach ($this->request->post['form'] as $k => $form) {
if ($form['type'] == 'email') {
$email = end($form);
}
if ($form['type'] != 'file') {
$this->forms_array['form'][$k]['title'] = $form['title'];
if (is_array(end($form))) {
$this->forms_array['form'][$k]['value'] = implode("; ", end($form));
} else {
$this->forms_array['form'][$k]['value'] = end($form);
}
}
}
}
$mail->setTo($this->config->get('config_email'));
if ($this->config->get('config_mail_engine') == 'mail') {
$mail->setFrom($email);
} else {
$mail->setFrom($this->config->get('config_email'));
}
$mail->setReplyTo($email);
$mail->setSender(html_entity_decode($email, ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $email), ENT_QUOTES, 'UTF-8'));
$mail->setHtml($this->load->view('mail/custom_mail', $this->forms_array));
if (!empty($this->forms_files_array)) {
foreach ($this->forms_files_array as $file) {
move_uploaded_file($file['tmp_name'], $file['file']);
$mail->AddAttachment($file['file']);
}
}
try {
$mail->send();
} catch (Exception $e) {
echo 'Сбой в отправке письма: ', $e->getMessage(), "\n";
}
if (!empty($this->forms_files_array)) {
foreach ($this->forms_files_array as $file) {
unlink($file['file']);
}
}
$this->response->redirect($this->url->link('information/contact/success'));
}