We can use a config file to store email settings. I have shown how to use a config file for sending an email in codeigniter. Steps: 1.create a config file in the config folder (application->config->app_config.php) My file is app_config.php When app_config.php file is added into config folder, add this config file into autoload.php file as follows. Just edit this line. This is how we load multiple config files at once.. :) 2. Add following code into app_config.php Here I ahev used gmail server settings for sending mails 3.Now we can user our controller for sending mails Thats all.. :)