Send email with tamplate codeigniter

0
Hello everyone, I'm a trainee in a programming company, and now I'm trying to send an email with tamplate using codeigniter, you could help me, I've already been able to send the email, the problem is that I can not send the data in the view that should load them, can you help me?

    
asked by anonymous 15.10.2015 / 16:59

2 answers

1

One way to send email from the html template is by using the IC parser class as follows:

1 ° Creating a view, where it will be the page to be sent by email:

<html>
<body>
<h3>{seu_nome}</h3>
<p>{mensagem}</p>
</body>
</html>

2 ° In the no controller method basically implemented as follows:

//Carregar biblioteca
$this->load->library('parser');

//Dados a serem renderizados na página de envio.
$data = array(
  'seu_nome' => 'João da silva',
  'mensagem' => 'Minha mensagem',
);

//Gerar página html e retorna-lá a variável $pagina
$pagina = $this->parser->parse('name_view_template', $data, true);
    
27.10.2015 / 04:02
0

In reality it is not difficult, trying here I have

 $message = $this->load->view('pasta/pagina', $data, true);

 $this->email->message($message);
 $this->email->send();

just pass the data to view

obg.

    
15.10.2015 / 17:44