Welcome Guest, Not a member yet? Register   Sign In
email library help
#1

[eluser]rob897[/eluser]
I created my own library called Emailerror.php, basically our boss wanted to be able to just update the config file to update where the emails come from and go to.

Here is the code and its not working... what am I missing?

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

class Emailerror {

function __construct()
{
  $CI =& get_instance();
  $CI->load->library('email');
  $config['protocol'] = 'sendmail';
  $config['mailpath'] = '/usr/sbin/sendmail';
  $config['charset'] = 'iso-8859-1';
  $config['wordwrap'] = TRUE;
  $CI->email->initialize($config);
}

function SendError($subject,$message)
{
  $CI->email->from($CI->config->item('email_from'), 'CI EMAIL');
  $CI->email->to($CI->config->item('email_to'));
  $CI->email->subject($subject);
  $CI->email->message($message);
  if (!$CI->email->send())
  {
      // Generate error
   echo $CI->email->print_debugger();
  }
  
}
}




Theme © iAndrew 2016 - Forum software by © MyBB