Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Inserir o nome do input na resposta do e-mail

Fiz um formulário no qual tem um input que captura o nome do usuario. Quero retornar uma resposta de e-mail com o nome do usuario que eu capturei pelo formulario.

Tentei de várias formas e não consigo colocar dentro da resposta do e-mail o nome do usuario que eu capturei pelo formulario.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cadastro extends CI_Controller {

    public function novo() {
        $this->form_validation->set_rules("nome", "nome", "required");
        $this->form_validation->set_rules("municipio", "municipio", "required");
        $this->form_validation->set_rules("organizacao", "organizacao", "required");
        $this->form_validation->set_rules("cargo", "cargo", "required");
        $this->form_validation->set_rules("telefone", "telefone", "required");
        $this->form_validation->set_rules("email", "email", "required");
        $this->form_validation->set_rules("cpf", "cpf", "required");
        $sucesso = $this->form_validation->run();
        if($sucesso) {


        $cadastro = array(
            "nome" => $this->input->post("nome"),
            "municipio" => $this->input->post("municipio"),
            "organizacao" => $this->input->post("organizacao"),
            "cargo" => $this->input->post("cargo"),
            "telefone" => $this->input->post("telefone"),
            "email" => $this->input->post("email"),
            "cpf" => $this->input->post("cpf")

    );
        $this->load->model("cadastros_model");
        $this->cadastros_model->salva($cadastro);
        $this->load->view("cadastro/novo");
    } else {

        $this->load->view("formulario/index");
    };

    $config["protocol"] = "smtp";
    $config["smtp_host"] = "ssl://smtp.gmail.com";
    $config["smtp_user"] = "davi@gmail.com";
    $config["smtp_pass"] = "12234564";
    $config["charset"] = "utf-8";
    $config["mailtype"] = "html";
    $config["newline"] = "\r\n";
    $config["smtp_port"] = '465';
    $this->email->initialize($config);

    $email = $this->input->post("email");
    $nome = $this->input->post("nome");




    $this->email->from("davi@inteligenciarelacional.com.br", "Evento - Teste");
    $this->email->to(array($email));
    $this->email->subject("Evento de ...");
    $this->email->message('<html><table width="960" height="auto" border="0" align="center" cellpadding="0" cellspacing="0"  bgcolor="#FFFFFF">
                                      <tr width="960" height="238">
                                        <td colspan="4">&nbsp;<img src="http://eventos.ainteligenciarelacional.com.br/img/resposta-email/topo.jpg" alt="" title=""/></td>
                                        </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td colspan="2"><font color="#02648f" size="5"><strong>Sua inscrição foi realizada com sucesso!</strong></font></td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td colspan="2">&nbsp;</td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td colspan="2"><font color="#02648f" size="3"><strong>Os dados registrados abaixo serão utilizados para sua participação no Evento.</strong></font></td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td colspan="2">&nbsp;</td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td><font color="#0099dc" size="3"><strong>Data:</strong></font> <font color="#848484" size="3">31/10/2016</font></td>
                                        <td width="45%">&nbsp;</td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td><font color="#0099dc" size="3"><strong>Horário:</strong></font> <font color="#848484" size="3">8:00 hrs</font></td>
                                        <td>&nbsp;</td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td colspan="2"><font color="#0099dc" size="3"><strong>Local:</strong></font> <font color="#848484" size="3">XXXX XXXX XXXX</font></td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td colspan="2">&nbsp;</td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td><font color="#0099dc" size="3"><strong>Nome do Participante:</strong></font> <font color="#848484" size="3">'.{'$nome'}.'</font></td>
                                        <td><font color="#0099dc" size="3"><strong>Município :</strong></font> <font color="#848484" size="3"></font></td>
                                        <td>&nbsp;</td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td><font color="#0099dc" size="3"><strong>Organização / Instituição: </strong></font> <font color="#848484" size="3"></font></td>
                                        <td><font color="#0099dc" size="3"><strong>Cargo :</strong></font> <font color="#848484" size="3"></font></td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td><font color="#0099dc" size="3"><strong>E-mail :</strong></font> <font color="#848484" size="3"></font></td>
                                        <td><font color="#0099dc" size="3"><strong>Telefone :</strong></font> <font color="#848484" size="3"></font></td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="5%">&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td width="5%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td colspan="2">&nbsp;</td>
                                        <td>&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td colspan="2"><font color="#02648f" size="3"><strong>Atenciosamente,</strong></font><strong><br />
                                            <font color="#0099dc" size="3">Equipe Inteligência Relacional<br />
                                          0800 940 3160 ou (16) 3505-3100.</font></strong></td>
                                        <td>&nbsp;</td>
                                      </tr>

                                      <tr width="960" height="120">
                                        <td colspan="4">&nbsp;<img src="http://eventos.ainteligenciarelacional.com.br/img/resposta-email/rodape.jpg" alt="" title=""/></td>
                                        </tr>
                                    </table></html>');
    $this->email->send();


    }
}
1 resposta
solução!

Arrumei uma solução

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software