Codeigniter how to html template for emails

codeigniter, email, templates

Solution

This is an example which i have done

 $data['map_to']=$this->input->post('map_to');
        $event=$this->db->query("query");
        if($event->num_rows()>0)
        {
            $data['event']=$event->row();
            $data['map_from']=$event->row()->address2;
        }
        else
        {
        $data['event']=NULL;    
        }
      $data['sender_mail'] = 'xx@xx.org';

        $this->load->library('email');
        $config = array (
                  'mailtype' => 'html',
                  'charset'  => 'utf-8',
                  'priority' => '1'
                   );
        $this->email->initialize($config);
        $this->email->from($data['sender_mail'], 'xxxx');
        $this->email->to($mail);
        $this->email->subject('Map Location');
        $message=$this->load->view('map_mail_format',$data,TRUE);
        $this->email->message($message);
        $this->email->send();       

Here i am loading a view page called `map_mail_format` and passing values to that view page (`$data`) then assign that view page to a variable then send mail with that message

Problem

I'm using below code to send email from my codeigniter based website's contact form, to do that i'm using below codes in my controller, ``` $entrydata['name']= $this->input->post('name'); $entrydata['email']= $this->input->post('email'); $entrydata['phone']= $this->input->post('phone'); $entrydata['message']= $this->input->post('message');$msg = 'Email has sent successfully'; $data['reset'] = TRUE; $this->load->library('email'); $this->email->from(set_value('email'), set_value('name')); $this->email->to('my@webs.com'); $this->email->subject("Get a quote enquiry"); $all = 'Name:' . set_value('name') ."\n". 'Email :' .' '. set_value('email') ."\n".'Phone :' .' '. set_value('phone') ."\n".'Message :' .' '. set_value('message'); $this->email->message($all); $s=$this->email->send(); $data['message'] = $msg; ``` Did anyone know how to add custom email template that'll hold my conact form informations?

Original source