Sending Email Using SMTP Gmail

Sometimes, will be needing this

[code]
$config = Array(
‘protocol’ => ‘smtp’,
‘smtp_host’ => ‘ssl://smtp.googlemail.com’,
‘smtp_port’ => 465,
‘smtp_user’ => [email protected],
‘smtp_pass’ => ‘testing’,
);

$this->load->library(‘email’, $config);
$this->email->set_newline(“rn”);

$this->email->from(strtolower($this->input->post(‘alamat_email’, TRUE)), strtolower($this->input->post(‘nama_lengkap’, TRUE)));
$this->email->to([email protected]);
$this->email->subject(‘Testing’);
$this->email->message($this->input->post(‘keterangan’, TRUE));

if($this->email->send())
{
$data[‘message’] = ‘Your email is sent;
$data[‘view’] = ‘contact’;
$this->load->view(‘frontend/template’, $data);
}
else
{
$data[‘message’] = ‘Your email not sent’;
$data[‘view’] = ‘contact’;
$this->load->view(‘frontend/template’, $data);
}
[/code]