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());

}

}

}

3 comments:

  1. Your very own commitment to getting the message throughout came to be rather powerful and have consistently enabled employees just like me to arrive at their desired goals.
    web development company

    ReplyDelete