Welcome Guest, Not a member yet? Register   Sign In
Email Library Constructor
#3

Avenirer has the ideal solution, but if you want to keep the config within the library for some reason, you could do something like:

PHP Code:
protected $emailto;
protected 
$appname;

public function 
__construct()
 
   {
 
       parent::__construct();
 
$this->load->library('email');

if(
ENVIRONMENT == 'development')
 {
 
$this->emailto 'developer@email';
 
$this->appname '***DEVELOPMENT APP***';
 }
 
   }

public function 
email()
 {
 
$message 'Email Message.';

 
$this->email->from($XXX'XXX');
 
$this->email->to($this->emailto);
 
$this->email->subject($this->appname.' -> Email Subject');
 
$this->email->message($message);
 
$this->email->send();
 } 
Reply


Messages In This Thread
Email Library Constructor - by 330Root - 06-01-2015, 02:06 PM
RE: Email Library Constructor - by Avenirer - 06-02-2015, 01:38 AM
RE: Email Library Constructor - by JayAdra - 06-02-2015, 03:20 AM
RE: Email Library Constructor - by 330Root - 06-02-2015, 06:58 AM
RE: Email Library Constructor - by Avenirer - 06-02-2015, 07:08 AM
RE: Email Library Constructor - by 330Root - 06-02-2015, 07:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB