Welcome Guest, Not a member yet? Register   Sign In
[Solved] Codeigniter: Load Library in a Core Class
#9

UPDATE:
I thought about the insights stated by dave.

For a current workaround I extended CI_Log as follows:

PHP Code:
class MY_Log extends CI_Log {
 
 public function __construct()
 
 {
 
   parent::__construct();
 
 }

 
 public function write_log($level$msg)
 
 {
 
   $result parent::write_log($level$msg);

 
   //include PHPMailer
 
   require_once(BASE_PATH.'application/libraries/PHPMailer/PHPMailerAutoload.php');

 
   //all the mail stuff
    $mail = new PHPMailer;

    $mail->CharSet "UTF-8";
    $mail->isSMTP();
    $mail->Host 'yoursmtp.server.com';
 
   $mail->send();
 
   //add user, password, etc

 
   return $result;
 
 }


As you can see, I used PHPMailer to send the error message via mail. All other mailing-stuff within CI libraries, views, controllers, etc are still handled by the build in CI Email library.

I'm not happy with the solution and would prefer to solve this without PHPMailer.
What do you guys think about the solution?
Reply


Messages In This Thread
RE: Codeigniter: Load Library in a Core Class - by SirGecco - 11-01-2016, 12:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB