Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:03:18+00:00 2026-06-11T17:03:18+00:00

I have a library in CodeIgniter called someclass. class someclass extends CI_Controller { function

  • 0

I have a library in CodeIgniter called “someclass”.

class someclass extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('email');
        $this->load->database();

       // $this->load-> library('database');

    }
    function email($naar=0,$onderwerp=0,$bericht=0){
        if ($naar > 0 && $naar<10) {

            $to = "tester@test.com"
            //this is the part where it goes wrong            

            $CI =& get_instance();
            $this->load->library('email');               
            //some one said that i needed ti assign the library's
            $this->_assign_libraries();

            $this->email->from('tester@test.com', 'test');
            $this->email->to($to);
            $this->email->subject($onderwerp);
            $this->email->message("Test

                bericht :
                ".$bericht);

            $this->email->send();
            // echo $this->email-> print_debugger();
        }
    }
}

I get the following error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: someclass::$email

Filename: libraries/someclass.php

Line Number: 139
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:03:19+00:00Added an answer on June 11, 2026 at 5:03 pm

    You can have 2 situations in my vision.

    1. First you can use a helper. Create a .php file (ex: general_helper.php) which can be autoloaded or loaded where you will use it. Autoload if from config/autoload.php with ‘general’ name.

    Here, you can create a method called sendEmail

    function sendEmail($naar=0,$onderwerp=0,$bericht=0)
    {
        $CI =& get_instance();
    
            $CI->load->library('email');               
            //or autoload it from /application/config/autoload.php
    
            $CI->email->from('tester@test.com', 'test');
            $CI->email->to($to);
            $CI->email->subject($onderwerp);
            $CI->email->message("Test
    
                bericht :
                ".$bericht);
    
            $CI->email->send();
    
    }
    

    Load your custom library in your controller and call id with sendEmail(....)

    1. You can extend native email library class and create a method inside that class called sendEmail for example:

      class MY_Email extends CI_Email {
      public function _construct()
      {
      parent::
      _construct();
      }
      public function sendEmail () ….. etc.
      }

    From your controller load native library class, use $this->load->library('email') and send your email by calling $this->email->sendEmail(...)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Admin controller in codeigniter class Admin extends CI_Controller { function __construct() {
I have a Controller called Register that looks like this: class Register extends CI_Controller
I have a code for form validating in my CodeIgniter app: $this->load->library('form_validation'); $this->form_validation->set_rules('message', 'Message',
I have built a multilingual website with CodeIgniter using this library: http://codeigniter.com/wiki/URI_Language_Identifier/ I use
I have developed a library in CodeIgniter and would like to call a function
I have a problem in extending native library in codeigniter. CONTROLLER: function search(){ $query_array
I am trying to extend the Upload library in CodeIgniter. I have been trying
I am using Codeigniter message library. In my controller I have the following code
My first question on codeigniter. I have integrated paypal in codeigniter using paypal library.
I have enabled google Minify in code igniter using this library on our website.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.