title: Code-Igniter: load & send email in a library
body: <p>I have a library in CodeIgniter called "someclass".</p>
  
  <pre><code>class someclass extends CI_Controller {
  
      function __construct() {
          parent::__construct();
          $this-&gt;load-&gt;helper('url');
          $this-&gt;load-&gt;helper('form');
          $this-&gt;load-&gt;library('email');
          $this-&gt;load-&gt;database();
  
         // $this-&gt;load-&gt; library('database');
  
      }
      function email($naar=0,$onderwerp=0,$bericht=0){
          if ($naar &gt; 0 &amp;&amp; $naar&lt;10) {
  
              $to = "tester@test.com"
              //this is the part where it goes wrong            
  
              $CI =&amp; get_instance();
              $this-&gt;load-&gt;library('email');               
              //some one said that i needed ti assign the library's
              $this-&gt;_assign_libraries();
  
              $this-&gt;email-&gt;from('tester@test.com', 'test');
              $this-&gt;email-&gt;to($to);
              $this-&gt;email-&gt;subject($onderwerp);
              $this-&gt;email-&gt;message("Test
  
                  bericht :
                  ".$bericht);
  
              $this-&gt;email-&gt;send();
              // echo $this-&gt;email-&gt; print_debugger();
          }
      }
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined property: someclass::$email
  
  Filename: libraries/someclass.php
  
  Line Number: 139
  </code></pre>