【问题标题】:CodeIgniter Ion_Auth :: Forgotten Password does not workCodeIgniter Ion_Auth ::忘记密码不起作用
【发布时间】:2014-03-29 11:56:17
【问题描述】:

我在使用 Ion_Auth 忘记密码功能时遇到了一些问题。

我已经加载了库并调用了函数,并传递了一个电子邮件地址(来自输入框)。

电子邮件模板存在于服务器上(与所有相关文件一样),并且该函数实际上返回 TRUE,通过使用 IF NOT 语句进行测试。

但是,没有发送电子邮件。现在我知道 CI 邮件功能可以工作了,因为我使用电子邮件库制作了一封快速邮件,并且它发送的邮件没有任何问题。

我测试了 Ion_Auth 库,发现它正在查找用户并使用模板生成电子邮件,并且在执行 $this->ci->email->send() 后返回 TRUE

如果没有收到电子邮件,怎么会这样呢?

【问题讨论】:

    标签: codeigniter


    【解决方案1】:

    而不是通过编辑任何 Ion Auth 文件来更改 Ion Auth 的默认行为...

    按照CodeIgniter 2 documentation配置邮件发送,请执行以下操作...

    1) 创建一个名为application/config/email.php 的文件,其中包含您的电子邮件设置as per the documentation

    <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    /*
    | -------------------------------------------------------------------
    | EMAIL SENDING SETTINGS
    | -------------------------------------------------------------------
    */
    
    $config['protocol'] = 'sendmail';  // 'mail', 'sendmail', or 'smtp'
    // other email options
    
    /* End of file email.php */
    /* Location: ./application/config/email.php */
    

    2) 在application/config/ion_auth.php文件中,将此值设置为TRUE

    $config['use_ci_email'] = TRUE;
    

    【讨论】:

      【解决方案2】:

      您可以通过将发送电子邮件代码重写为原生 PHP 来更改默认的 ion auth 行为,也可以更改协议。转到forgotten_password()$this-&gt;ci-&gt;email-&gt;initialize($config); 之前的$config['protocol'] = OPTION;,其中选项可以是mailsendmailsmtp

      http://codeigniter.com/user_guide/libraries/email.html

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 2017-11-16
        • 2012-12-20
        • 2012-06-09
        • 2016-11-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-07
        相关资源
        最近更新 更多