CodeIgniter Email Configuration File

Turns out that while you can have an email configuration file (under application/config/email.php), this file will NOT work if you put into environment specific folders (e.g. application/config/development/email.php).

To make it work in such cases (e.g. for MockSMTP), you’ll instead need to check the environment and use the appropriate configuration. 

Here’s an example of what to put in the file:

if (ENVIRONMENT === 'development') {
    $config['protocol'] = 'smtp';   
    $config['smtp_port'] = 1025;    
else { // Production and other servers
    $config['protocol'] = 'smtp';   
    $config['smtp_port'] = 25; 

$config['smtp_host'] = 'localhost'; 
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;