Welcome Guest, Not a member yet? Register   Sign In
CI 2.0 Extended Email class stopped working
#1

[eluser]Ki[/eluser]
I have migrated from older version to 2.0 And while there were little issues, one of them is the extended MY_Email that now refuses to work. It worked in the older version.
I have extended the CI email library as such (in my core folder):

Code:
class MY_Email extends CI_Email {

    function  __construct() {
    $this->CI = & get_instance();

        parent::CI_Email($this->CI->config->config['email']);
    }

function email_something(){
   // data processing + emailing is done here
}
}

In my controller I have:
Code:
$result=$this->email->email_something($_POST);

I am perplexed why it stopped working in CI 2.0

Code:
Fatal error: Call to undefined method CI_Email::email_something() in
#2

[eluser]InsiteFX[/eluser]
Did you place the library in application/core ?

InsiteFX
#3

[eluser]Ki[/eluser]
Thank you,
Email is not a core library, therefore should not have been placed in /core/ I moved it to Applications directory and now its all good :-)
#4

[eluser]diZzyCoDeR[/eluser]
Like Zombigeddon, this thread rises from the dead and walks amongst the living once more.

I did same thing as OP and having same trouble, but, I had moved MY_Email to /application/libraries/ already.

So confuzded. Any thoughts on why it won't auto-extend when called normally (actually I'm autoloading 'email')?

But I'm not extending it with the instance like OP... is that wrong? This is based on the CI manual under extending libraries.

Code:
class MY_Email extends CI_Email {

        var    $_attach_cont    = array();

        function __construct() {
            parent::__construct();
        }

        /**
         * Assign file attachments
         *
         * @access    public
         * @param    string
         * @return    void
         */
        function attach($filename, $disposition = 'attachment', $content = '')
        {
                $this->_attach_name[] = $filename;
                $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename))));
                $this->_attach_disp[] = $disposition; // Can also be 'inline'  Not sure if it matters
                $this->_attach_cont[] = $content;
                return $this;
        }




Theme © iAndrew 2016 - Forum software by © MyBB