<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	if ( ! function_exists('email()')){
		function email($recipient,$template,$subject){
		    // Get a reference to the controller object
		    $CI = get_instance();

		    // $config = Array(
			//   'protocol' => 'smtp',
			//   'smtp_host' => 'mail.xpluscloud.com',
			//   'smtp_crypto' => 'ssl',
			//   'smtp_port' => 25,
			//   'smtp_user' => '',
			//   'smtp_pass' => '',
			//   'mailtype' => 'html',
			//   'charset' => 'iso-8859-1',
			//   'wordwrap' => TRUE
			// );

			$config = Array(
				'protocol'  => 'smtp',
				'smtp_host' => 'ssl://smtp.gmail.com',
				'smtp_port' => 465,
				'smtp_user' => 'xplus.noreply@gmail.com',
				'smtp_pass' => 'xplus@23',
				'mailtype'  => 'html',
				'charset' 	=> 'iso-8859-1',
			  	'wordwrap' 	=> TRUE
				// 'charset'   => 'utf-8'
			);

			$CI->load->library('email', $config);
	      	$CI->email->set_newline("\r\n");
			$CI->email->from('support@xplus.ph','XPlus Support');
			$CI->email->to($recipient);
			$CI->email->subject($subject);
			$CI->email->message($template);


	      	if($CI->email->send())
			{
				return TRUE;
			}
			else
		    {
				return show_error($CI->email->print_debugger());
				return FALSE;
		    }
		}
	}
