CodeIgniter Ion Auth不发送激活电子邮件

时间:2014-01-06 00:51:09

标签: php codeigniter email smtp ion-auth

我使用以下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文档,但我没有收到任何电子邮件。还有什么需要做的吗?谢谢!

4 个答案:

答案 0 :(得分:4)

检查

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

是否已配置?

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

答案 1 :(得分:4)

我的工作有一些小改动......比如:

在图书馆中转到ion_auth:添加set_newline("\r\n")

enter image description here

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

enter image description here

但请记住set_newline()非常重要

答案 2 :(得分:0)

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

=========

=========使用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());

  }


}

答案 3 :(得分:0)

尝试一下。希望对您有帮助。

SET @s := 0;

UPDATE users2 u
    SET u.ranking = (@s := @s + 1)
    ORDER BY score DESC ;