【问题标题】:CodeIgniter Ion Auth not sending activation emailCodeIgniter Ion Auth 不发送激活电子邮件
【发布时间】:2014-01-23 08:13:49
【问题描述】:

我使用以下 smtp 信息配置了 CodeIgniter Ion Auth:

$config['use_ci_email'] = FALSE;
$config['email_config'] = array(
    'mailtype' => 'html',
    'protocol' => 'smtp',
    'smtp_host' => 'mail.example.com',
    'smtp_user' => 'support@example.com', // actual values different
    'smtp_pass' => 'password',
    'smtp_port' => '26'
);

当我注册一个帐户时,Ion Auth 只是说“已发送激活电子邮件”,但我的收件箱中什么也看不到(也检查了垃圾邮件文件夹)。我用 SMTP 测试工具检查了信息,$config['email_config'] 提供的 SMTP 信息是正确的。我遵循了 Ion Auth 文档,但没有收到任何电子邮件。还有什么需要做的吗?谢谢!

【问题讨论】:

  • 将 $config['use_ci_email'] 设置为 TRUE 并配置 CodeIgniter 的 Email 类就可以了。
  • 你必须在本地主机上检查它。除非配置,否则电子邮件不会在 localhost 上发送
  • @raheelshan 这到底是什么意思? :)
  • @RobertGrant install this 它会起作用。
  • 你是说如果你指向本地主机发送邮件并且本地主机上没有邮件服务器,它就不会工作吗?如果是这样,为什么要特别指定 localhost,因为这适用于任何主机名。您最初的意思是:“检查服务器上是否有邮件服务器以及您指向的端口。”

标签: php codeigniter email smtp ion-auth


【解决方案1】:

检查

$config['email_activation'] = TRUE; // Email Activation for registration
$config['manual_activation'] = FALSE;  

是否已配置??

转到config/ion_auth.php,确保$config['use_ci_email'] 设置为TRUE。

【讨论】:

  • 为此工作,应将其电子邮件配置存储在配置文件夹中的文件“email.php”中。
【解决方案2】:

我的工作进行了一些小改动...例如:

在库中转到ion_auth:添加set_newline("\r\n"):

也在配置文件夹中转到 ion_auth,您的电子邮件配置应如下所示:

但请记住set_newline() 非常重要

【讨论】:

    【解决方案3】:

    这将起作用,它在我的系统中的一个控制器中使用..

    =========

    ========使用 GMAIL

    public function sendmail($data=array())
    {
    
    
        $config = Array(
    
        'protocol' => 'smtp',
    
        'smtp_host' => 'ssl://smtp.googlemail.com',
    
        'smtp_port' => 465,
    
        'smtp_user' => 'emailaddress@gmail.com',
    
        'smtp_pass' => 'xxxxxxx',
    
        'mailtype'  => 'html', 
    
        'charset'   => 'iso-8859-1',
    
        'wordwrap'   =>TRUE
    
    );
    
    
    $this->load->library('email',$config); // Note: no $config param needed
    
        //$this->email->initialize($config);
    
    $this->email->from('emailaddress@gmail.com', 'Test Mailer');
    
    $this->email->to('receiver@gmail.com');
    
    $this->email->subject('Test email from CI and Gmail');
    
    $this->email->message('This is a test, using CodeIgniter Email Class.');
    
    $this->email->set_newline("\r\n");
    
    
     if ($this->email->send()) {
    
         echo 'Your email was sent, thanks.';
    
      } else {
    
         show_error($this->email->print_debugger());
    
      }
    
    
    }
    

    【讨论】:

      【解决方案4】:

      试试这个。希望对你有帮助。

      $config['email_smtp'] = TRUE;
      $config['email_from'] = 'mail.example.com';
      $config['email_from_name'] = 'mail';
      $config['admin_email'] = 'mail.example.com';
      $config['mailtype'] = "html";
      $config['crlf'] = "\r\n";
      $config['newline'] = "\r\n";
      $config['wordwrap'] = FALSE;
      $config['charset'] = "utf-8";
      
      /**
       * SMTP Settings
       */
      if ($config['email_smtp'] === TRUE) {
          $config['protocol'] = "smtp";
          $config['smtp_host'] = 'support@example.com';
          $config['smtp_port'] = '465';
          $config['smtp_timeout'] = '5';
          $config['smtp_user'] = 'mail.example.com';
          $config['smtp_pass'] = 'password';
      }
      

      【讨论】:

      • 你在哪里添加这个?
      猜你喜欢
      • 1970-01-01
      • 2014-08-11
      • 1970-01-01
      • 2018-08-19
      • 1970-01-01
      • 2014-03-03
      • 2011-01-02
      • 2014-04-21
      • 2015-04-09
      相关资源
      最近更新 更多