0
Therefore, in my login system I have a zone where the user asks to recover the password and is sent an email with the new password. When testing the code, I noticed that if I change the data from my email server, the email continues to be sent without giving any error.
Does anyone know why this is happening?
Code:
$servidoremail = file(APPPATH.'libraries/connections/servidoremail.txt',FILE_IGNORE_NEW_LINES);
$sname= $servidoremail['0'];
$suser= $servidoremail['1'];
$spass= $servidoremail['2'];
$sport= $servidoremail['3'];
$email = addslashes($_POST['email']);
$user = $this->Usuario_model->getuserbyemail($email);
if(isset($user)){
$novasenha =addslashes(substr(md5(time()), 0, 6));
$this->Usuario_model->updatepass($novasenha,$email);
$config['protocol'] = 'smtp';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = $sname;
$config['smtp_auth'] = true;
$config['smtp_user'] = $suser;
$config['smtp_pass'] = $spass= $servidoremail['2'];
$config['smtp_port'] = $sport;
$config['smtp_auto_tls'] = true;
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('[email protected]');
$this->email->to($email);
$this->email->subject('Nova password');
$this->email->message('Nova senha: '.$novasenha);
if($this->email->send()){
$data['resposta'] = 'Password alterada, verifique o seu email';
$data['tipo'] = 'bg-success';
$this->load->view('recuperarpassword',$data);
}else{
echo $this->email->print_debugger();
//$data['resposta'] = 'Erro ao enviar email';
//$data['tipo'] = 'bg-danger';
//$this->load->view('recuperarpassword',$data);
}
There is not much to identify because the function is incomplete. The array
$config
is being used in place of your code?– Victor Carnaval
You’re right, I already reworked the text. Continue to send the email
– Marco Silva