Showing posts with label Codeigniter Send Email using Gmail. Show all posts
Showing posts with label Codeigniter Send Email using Gmail. Show all posts

Saturday, October 24, 2009

Codeigniter Send Email using Gmail

<?

class Emailer extends Controller

{

function Emailer()

{

parent::Controller();

}

function index()

{

$config = Array(

'protocol' => 'smtp',

'smtp_host' => 'ssl://smtp.googlemail.com',

'smtp_port' => 465,

'smtp_user' => 'yourusername@gmail.com',

'smtp_pass' => 'yourpassword',

'mailtype' => 'html',

'charset' => 'iso-8859-1',

'wordwrap' => TRUE

);


$this->load->library('email', $config);

$this->email->set_newline("\r\n");


$this->email->from('dixanta@creatorsnepal.com');

$this->email->to('dixanta@hotmail.com');

$this->email->subject('This is an email test');

$this->email->message('It is working. Great!');


if($this->email->send())

{

echo 'Your email was sent, fool.';

}


else

{

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

}

}

}