Email SMTP Setup

In order to use an SMTP server for all outgoing emails, you need to configure it in/application/config/email.php

SMTP server over port 25
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'yourSMTPhost.com';
$config['smtp_port'] = '25';
$config['smtp_user'] = 'yourUser';
$config['smtp_pass'] = 'yourPassword';

SMTP servers that require SSL connection
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://yourSMTPhost.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'yourUsername';
$config['smtp_pass'] = 'yourPassword';
$config['newline'] = "\r\n";

SMTP server that requires SSL and TLS (ie. gmail and Mandrill)
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://yourSMTPhost.com';
$config['smtp_port'] = '465'; // or port 587 for gmail
$config['smtp_user'] = 'yourUsername';
$config['smtp_pass'] = 'yourPassword';
$config['newline'] = "\r\n";
$config['smtp_crypto'] = 'tls';

If you still have issues sending emails you might need to use PHPmailer instead of the nativ mail() function. Just use the following config in your email.php file and change the Host, User, Password, Port and Crypto to fit your mail provider settings.

PHPmailer config

$config['useragent']        = 'PHPMailer';              // Mail engine switcher: 'CodeIgniter' or 'PHPMailer'
$config['protocol']         = 'smtp';                   // 'mail', 'sendmail', or 'smtp'
$config['mailpath']         = '/usr/sbin/sendmail';
$config['smtp_host']        = 'yourSMTPhost.com';
$config['smtp_user']        = 'yourUsername';
$config['smtp_pass']        = 'yourPassword';
$config['smtp_port']        = 465;
$config['smtp_timeout']     = 5;                        // (in seconds)
$config['smtp_crypto']      = 'ssl';                       // '' or 'tls' or 'ssl'
$config['smtp_debug']       = 0;                        // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data
$config['wordwrap']         = true;
$config['wrapchars']        = 76;
$config['mailtype']         = 'html';                   // 'text' or 'html'
$config['charset']          = 'utf-8';
$config['validate']         = true;
$config['priority']         = 3;                        // 1, 2, 3, 4, 5
$config['crlf']             = "\r\n";                     // "\r\n" or "\n" or "\r"
$config['newline']          = "\r\n";                     // "\r\n" or "\n" or "\r"
$config['bcc_batch_mode']   = false;
$config['bcc_batch_size']   = 200;