Welcome Guest, Not a member yet? Register   Sign In
email.php config file not loaded if CI_Email class is extended
#2

[eluser]Unknown[/eluser]
I just came across extending the Email class with the similar problems.
It turns out that you will need to pass the parameters to the parent constructor.

So the code will look like:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Email extends CI_Email
{

    public function __construct($config = array())
    {
        parent::__construct($config);
    }


}

?>

Since the CI_Email __construct takes in the $config array as a parameter.
Code:
/**
  * Constructor - Sets Email Preferences
  *
  * The constructor can be passed an array of config values
  */
public function __construct($config = array())
{
  if (count($config) > 0)
  {
   $this->initialize($config);
  }
  else
  {
   $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
   $this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE;
  }

  log_message('debug', "Email Class Initialized");
}


Messages In This Thread
email.php config file not loaded if CI_Email class is extended - by El Forum - 03-07-2012, 01:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB