I am trying to send email through Codeigniter email library form localhost. Below is my code.
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'xxxxxx',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]');
$this->email->to('[email protected]');
$this->email->subject('Subject');
$this->email->message('Sample message');
if (!$this->email->send())
{
show_error($this->email->print_debugger());
}
else
{
echo 'Your e-mail has been sent!';
}
I am getting following errors:-
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method. &
Severity: Warning
Message: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
Filename: libraries/Email.php
Line Number: 1896
Backtrace:
File: D:\xampp\htdocs\ajax\application\controllers\angular_http.php Line: 29 Function: send
File: D:\xampp\htdocs\ajax\index.php Line: 315 Function: require_once