PHP code:
$from = 'shahrushabh1996@gmail.com';
$config = array(
'protocol'=>'smtp',
'smtp_host'=>'ssl://smtp.googlemail.com',
'smtp_port'=>'465',
'smtp_user'=>'shahrushabh1996@gmail.com',
'smtp_pass'=>'********',
'mailtype'=>'html',
'charset'=>'UTF-8'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->to($personemail);
$this->email->from($from);
$this->email->subject('it is a demo email by Rushabh Shah');
$this->email->message('demo message');
if(!$this->email->send()){
show_error($this->email->print_debugger());
}
else{
echo 'email is sent';
}
Error:
Unable to send email using PHP mail().
Please help me how to resolve following error? this method is working fine in different controller but not working in this controller how to resolve it? please help me.