What I tried:
I tried using below config and generated app password
I tried also updating the php.ini with below details.
public function EmailNotifications(){
$config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'validation'=>TRUE, 'smtp_timeout'=>30, 'smtp_port'=> 465, 'smtp_user' => 'sender@gmail.com', // change it to yours 'smtp_pass' => 'ualxykfuomcrfsdi', // this is the app password generated 'mailtype' => 'html', 'charset' => 'iso-8859-1', 'wordwrap' => TRUE ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('sender@gmail.com','Teradyne Online Shipment'); // change it to yours $this->email->to("receiver@gmail.com"); // change it to yours $this->email->subject('Account Request'); $this->email->message($message); if($this->email->send()) { redirect('admin/home'); } else { show_error($this->email->print_debugger()); } }
Error:
Questions:
- Do I need to create a Gmail account for Business or just the personal account?
- Is the configuration different for XAMPP localhost?