Using email address from config to send email |
[eluser]doubleplusgood[/eluser]
Greetings, I am storing site email addresses in the config, so that it would be easy to change sitewide email addresses if the need arose. In my config I have the following; Code: /* However, i'm trying to access this in my controller to send an email as follows; Code: $this->_obj->email->from($this->config->item('sales_email'), $this->config->item('site_title')); This is throwing an error with the controller. Could someone tell me if a config item can be used in this way? And also if you have a solution, that would be grand. Neil
[eluser]$ilovephp[/eluser]
why not try the set_item() function? Code: $this->config->set_item('site_email','[email protected]'); but i doubt it will give same problem. Why not post the error message instead?
[eluser]mddd[/eluser]
Another easy way is to put some constants in /config/constants.php. I like constants because using them is shorter to write. Like so: Code: define('SITE_EMAIL', '[email protected]'); In your code you can use these constants like Code: $this->email->from( SITE_EMAIL ); |
Welcome Guest, Not a member yet? Register Sign In |