I am added these code in godaddy server but mail function not working. I have already app password created.its local server work successfully but in godaddy server not working properly.. please help.
$this->load->library('email');
$config = Array(
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'mymail id', // change it to yours
'smtp_pass' => 'myapppassword', // change it to yours
'mailtype' => 'text',
'charset' => 'utf-8',
wordwrap' => TRUE
);
$message="Hello ";
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from('mymailid'); // change it to yours
$this->email->to($email);// change it to yours
$this->email->subject('Login Details');
$this->email->message($message);
if ( $this->email->send() ) {
echo 'Your Email has successfully been sent.';
}
else {
$errors = $this->email->print_debugger();
print_r($errors);
}