Email Configuration in CodeIgniter

hey guys,

lets see how to configure email in codeigniter today..

1. Create a page name email.php in project/application/config/

copy this code over there..

<?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);
$config[‘protocol’] = ‘smtp’;
$config[‘smtp_host’] = ‘smtp.company.com’;
$config[‘smtp_port’] = 25;

?>

2. Goto your controller page..just paste this below code where ever it requires to send a mail..

$this->load->library(’email’, $config);
$this->email->from(‘fromemail@company.net’, ‘Company Name/Admin’);

$this->email->to($empemail / ‘someone@example.com’);

$this->email->subject(‘Related Subject’);
$this->email->message(‘Your message ..’);

$this->email->send();

echo $this->email->print_debugger();

Thats it..very simple..right 😉

Reference Link : Click , another

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s