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 6252357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:47:10+00:00 2026-05-24T13:47:10+00:00

I have a problem creating my own librairie to send email. This is my

  • 0

I have a problem creating my own librairie to send email.
This is my code:

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

    private $CI;

    public function __construct() {
        $this->load->library('email');
            $this->CI =& get_instance();
        }

    public function signup($info, $lang) {

         $CI->email->to($info['email']); 
        ...
         $CI->email->send();
         return TRUE;
    }

    public function newsletter($info, $lang) {

         $CI->email->from('xxx@xxx.om', 'Newsletter');
        ...
         $CI->email->send();
         return TRUE;
    }

}

/* End of file Send_email.php */
/* Location: ./system/application/libraries/Send_email.php */

I get the error:

Message: Undefined property: Send_email::$load Filename:
libraries/Send_email.php Line Number: 9 Fatal error: Call to a member
function library() on a non-object …

I tried $this->CI->load->library('email');
But I get the error:

Trying to get property of non-object

It seems that the librairie can’t be loaded… I would like to load it from the construtor so I don’t have to do it in each function.
If I load it from each function it works well..

Could you help me?
Thanks!

  • 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-05-24T13:47:11+00:00Added an answer on May 24, 2026 at 1:47 pm

    You need to initialize $CI before using it to load the email library…

    public function __construct()
    {
        $this->CI =& get_instance();
        $this->CI->load->library('email');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an irritating problem, I'm creating an asp.net web service; this service should
I have a problem with creating my own subclass of NSData , which I
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder
i have a small problem, i am creating a edit page in my asp.net
I have run into a strange problem, i am creating a lot of dynamically
I have a PHP script located in my Wordpress installation's root folder wordpress-root/includes/login.php When
I have the very common problem of creating an index for an in-disk array
I have inserted some data in table using encryption (encrypted by creating my own
I have a problem over here. You see, I wanted to create my own

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.