Jump to content
Sign in to follow this  
cha0s

как в функцию mail запихнуть шаблон?

Recommended Posts

Нужно чтоб пользователю на почту приходил мой html шаблон, пример

                                $subject = $value['firstname'] . '!!';
				$subject .= sprintf($this->language->get('text_vip'), $this->config->get('config_name'));	
				$message  = sprintf($this->language->get('text_vip2'), $this->config->get('config_name')) . "\n\n";
	
				$mail = new Mail();
				$mail->protocol = $this->config->get('config_mail_protocol');
				$mail->parameter = $this->config->get('config_mail_parameter');
				$mail->hostname = $this->config->get('config_smtp_host');
				$mail->username = $this->config->get('config_smtp_username');
				$mail->password = $this->config->get('config_smtp_password');
				$mail->port = $this->config->get('config_smtp_port');
				$mail->timeout = $this->config->get('config_smtp_timeout');				
				$mail->setTo('$value['email']');
				$mail->setFrom($this->config->get('config_email'));
				$mail->setSender($this->config->get('config_name'));
				$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
				$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
				$mail->send();

Скажите как мне в $message засунуть html шаблон? пробую оформить статично ну сам что-то быстро набросать типа <html><span style="color:red;">dsadasdsa</span></html>, оно приходит как экранированное уже... а не htmlom:(

Share this post


Link to post
Share on other sites

Спасибо! то что надо:)

Share this post


Link to post
Share on other sites

а еще вопрос как туда запихнуть целый htmlный шаблон? он уже готов лежит template/mail/vip.tpl, не получается его подгрузить что-то) $this->template как понимаю говорит о том ему куда данные из $this->data будут уходить на шаблон, а как сам шаблон целиком пихнуть?) с помощью file_get_content что-то не вышло))

Share this post


Link to post
Share on other sites

$this->template = 'mail.tpl';

$mail->setHtml($this->render());

  • +1 1

Share this post


Link to post
Share on other sites

спасибо еще раз  ^_^

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.