Welcome Guest, Not a member yet? Register   Sign In
please help me..urgent! send mail problem
#1

[eluser]miss_amylee[/eluser]
i have problem that i really dunno how to solve it. i want to load my template (using template_path) and load it as a view file before send it as mail.the problem now is, it says 'unable to load file .php' which i think its not detect the template path. but if i echo the template path, the path is there. i hv no experience with parse library.hope somebody can help me..im new to CI and sory for my english..here is my controller send.php..

Code:
<?php

class Send extends Controller{
    
    function __construct()
    {
        parent::Controller();
        
        $this->load->library('email');
    }
    
    function index()
    {  
        
      
       $this->load->database();
       $sql = "SELECT * FROM mail WHERE mid = 1001 LIMIT 1";
       $q = $this->db->query($sql);
       if($q->num_rows() == 1)
       {
           $row = $q->row();
           $data = array(
           'nf_editor' => $row->nf_editor,
           'subject' => $row->subject,
           'message' => $row->message,
           'template_id' => $row->template_id
          
           );
        
        $this->db->where('template_id',$template_id);
        $sql = $this->db->get('mail_templates');        
        $template = $sql->row();
              
        //echo $template->template_path;
        //echo base_url().$template->template_path.'email';
        $this->load->library('parser');
        $html = $this->parser->parse($template->template_path, $data);
        
        
        echo $html.'HTML';
        
        
        //$this->load->view('farah/test_view',$data);
       }
        $this->email->clear(); # to clear anything thats already here
        
        $config['mailtype'] = 'html';
        $config['charset'] = 'utf-8';
        
        $this->email->initialize($config);
        
        $this->email->to('[email protected]');
        $this->email->from('[email protected]');
        $this->email->subject($row->subject);
        $this->email->message($html);
                
        $email_sent = $this->email->send();

    }  
    
}


?>


Messages In This Thread
please help me..urgent! send mail problem - by El Forum - 12-09-2009, 08:45 PM
please help me..urgent! send mail problem - by El Forum - 12-09-2009, 10:16 PM
please help me..urgent! send mail problem - by El Forum - 12-09-2009, 10:35 PM
please help me..urgent! send mail problem - by El Forum - 12-09-2009, 10:36 PM
please help me..urgent! send mail problem - by El Forum - 12-09-2009, 10:51 PM
please help me..urgent! send mail problem - by El Forum - 12-09-2009, 11:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB