Having trouble with this, maybe someone can help.
I have a Library that handles on my email functions. I have 3 environments setup. Development, Test & Production. What I am trying to do is have different application names and mailto addresses depending on the environment. I've tried to do this through constructor but no luck. Basically, I don't want test emails going to real users and I'd like to better distinguish what is test from what is actual data for my testers who are also users...
PHP Code:
public function __construct()
{
parent::__construct();
$this->load->library('email');
if(ENVIRONMENT == 'development')
{
$emailto = 'developer@email';
$appname = '***DEVELOPMENT APP***';
}
elseif(ENVIRONMENT == 'testing')
{
$emailto = 'test@email';
$appname = '*TEST APP*';
}
elseif(ENVIRONMENT == 'production')
{
$emailto = 'dynamic@email';
$appname = 'LIVE APP';
}
}
public function email()
{
$message = 'Email Message.';
$this->email->from($XXX, 'XXX');
$this->email->to($emailto);
$this->email->subject($appname.' -> Email Subject');
$this->email->message($message);
$this->email->send();
}
I can get this to work if I put the code directly in each function but it would be so much nicer if it could just all be in one spot!!
Sorry for any formatting problems, I am not a forum pro... THANK YOU.