I am trying to send mail from localhost(LAMP) using codeigniter using the following code snippet. It shows "Email sent.". But the email is not received at my email address.
function sendMail() {
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'xxx@gmail.com', // change it to yours
'smtp_pass' => 'xxx', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = '';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('xxx@gmail.com'); // change it to yours
$this->email->to('xxx@gmail.com'); // change it to yours
$this->email->subject('testing');
$this->email->message($message);
if($this->email->send()) {
echo 'Email sent.';
}
else {
show_error($this->email->print_debugger());
}
}