无法在codeigniter中的电子邮件模板中发送php值

I am working in Codeigniter framework. I have written send email code using its email library that looks like below :

$this->load->library('email', $config);

        $this->email->set_newline("
");

        $this->email->from('info@webbrainstechnologies.com', 'Instagram Shop');
        $content = array(
                'user_id'       =>$user_id,
                'first_name'    =>$this->input->post('first_name'),
                'last_name'     =>$this->input->post('last_name'),
                'mobile'        =>$this->input->post('mobile_no'),
                'email'         =>$this->input->post('email'),
                'address'       =>$this->input->post('address'),
                'payment_type'  =>$this->input->post('payment_type'),
                'comment'       =>$this->input->post('comment'),
                'order_date'    =>date("Y-m-d h:i:sa")
            );
        $data['content'] = $content;
        $this->email->to($to);  // replace it with receiver mail id
        $this->email->subject("Invoice"); // replace it with relevant subject

        $body = $this->load->view('buyer/invoice',$data,TRUE);
        $this->email->message($body);  
        $this->email->send();

And I used $data['content'] in view file as

$content['first_name']

In view file I send some dynamic value that I want to send in email. But in mail it gives an error like given variable is not define.

So what should I have to do?

Use this:

$this->load->library('email', $config);

    $this->email->set_newline("
");

    $this->email->from('info@webbrainstechnologies.com', 'Instagram Shop');
    $data = array(
            'user_id'       =>$user_id,
            'first_name'    =>$this->input->post('first_name'),
            'last_name'     =>$this->input->post('last_name'),
            'mobile'        =>$this->input->post('mobile_no'),
            'email'         =>$this->input->post('email'),
            'address'       =>$this->input->post('address'),
            'payment_type'  =>$this->input->post('payment_type'),
            'comment'       =>$this->input->post('comment'),
            'order_date'    =>date("Y-m-d h:i:sa")
        );

    $this->email->to($to);  // replace it with receiver mail id
    $this->email->subject("Invoice"); // replace it with relevant subject

    $body = $this->load->view('buyer/invoice',$data,TRUE);
    $this->email->message($body);  
    $this->email->send();

In your view, Use direct $user_id and so on.