Авторизация Codeigniter ion забыла пароль, не отправляя электронную почту

Если я отправлю запрос на сброс нового пароля на свой адрес электронной почты, CodeIgniter не отправит письмо. Но он возвращает сообщение о том, что отправлено электронное письмо для сброса пароля. Так что ошибку не выдает.

Я использую CodeIgniter 2.1.4 и IonAuth 2.5.2.

$config['use_ci_email'] = TRUE;

Я уже установил для этой конфигурации значение TRUE, но по-прежнему не отправляю почту.


person psab_72    schedule 21.06.2014    source источник
comment
любое решение еще?   -  person LIGHT    schedule 12.01.2017


Ответы (2)


Ничего не меняйте в ion_auth.php. файл как есть:

$config['use_ci_email'] = FALSE; // Send Email using the builtin CI email class, if false it will return the code and the identity
$config['email_config'] = array(
    'mailtype' => 'html',
);

а затем «Auth.php», который является файлом контроллера, меняет некоторый код, например:

if ($forgotten)
            {
                // if there were no errors
//              $this->session->set_flashdata('message', $this->ion_auth->messages());
//              redirect("auth/login"); //we should display a confirmation page here instead of the login page
                            $config = [
                                            'protocol' => 'smtp',
                                            'smtp_host' => 'ssl://smtp.googlemail.com',
                                            'smtp_port' => 465,
                                            'smtp_user' => 'xxx',
                                            'smtp_pass' => 'xxx',
                                            'mailtype' => 'html'
                                        ];
                            $data = array(
                                'identity'=>$forgotten['identity'],
                                'forgotten_password_code' => $forgotten['forgotten_password_code'],
                            );
                            $this->load->library('email');
                            $this->email->initialize($config);
                            $this->load->helpers('url');
                            $this->email->set_newline("\r\n");

                            $this->email->from('xxx');
                            $this->email->to("xxx");
                            $this->email->subject("forgot password");
                            $body = $this->load->view('auth/email/forgot_password.tpl.php',$data,TRUE);
                            $this->email->message($body);

                            if ($this->email->send()) {

                                $this->session->set_flashdata('success','Email Send sucessfully');
                                return redirect('auth/login');
                            } 
                            else {
                                echo "Email not send .....";
                                show_error($this->email->print_debugger());
                            }
            }
            else
            {
                $this->session->set_flashdata('message', $this->ion_auth->errors());
                redirect("auth/forgot_password");
            }
person Maulik Gushani    schedule 01.03.2017

Я использую конфигурацию в codeigniter application/config/email.php

$config['protocol'] = 'mail';
$config['wordwrap'] = false;
$config['mailtype'] = 'html';

приложение/config/autoload.php

$autoload['libraries'] = array('lang','template', 'email','form_validation','session','encrypt','pagination','upload','database' );

В контроллере

$this->email->from(MAIL,MAIL);
$this->email->to($mailto);
$this->email->subject($text_subject);
$this->email->message($this->load->view('email/template_email',$data,TRUE));
$this->email->send();
person tungbk29    schedule 21.06.2014