codeigniter has a native helper in system/helper/email_helper that provides a function called send_email() that uses php mail() function. While that is pretty basic it gives you an idea how to setup things.
What i suggest is create a helper to overwrite the native. i.e create a MY_email_helper.php in application/helpers and within define your own send_email() function
/**
* Send an email
*
* @access public
* @return bool
*/
if ( ! function_exists('send_email'))
{
function send_email($recipient, $subject, $message, $from_email = NULL, $from_name = NULL, $method = NULL)
{
// Obtain a reference to the ci super object
$CI =& get_instance();
switch(strtolower($method))
{
/*
* SES Free Tier allows 2000 emails per day (Up to 10,000 per day)
* see: http://aws.amazon.com/ses/pricing/
*/
case 'ses':
$CI->load->library('aws_lib');
$sender = $from_email ? ($from_name ? $from_name.' <'.$from_email.'>' : $from_email) : NULL;
$CI->aws_lib->send_email($recipient, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $sender);
break;
/*
* Mandrill Free Tier allows 12,000 per month
* see: http://mandrill.com/pricing/
*/
case 'mandrill':
// todo...
break;
default:
$CI->load->library('email');
$CI->email->from($from_email, $from_name);
$CI->email->to($recipient);
$CI->email->subject('=?UTF-8?B?'.base64_encode($subject).'?=');
$CI->email->message($message);
$CI->email->send();
log_message('debug', $CI->email->print_debugger());
}
}
}
that means if you're already using send_mail() function just load the MY_email_helper and everything will work as per normal.