I am having some trouble with the Ion_Auth forgotten password function.
I have loaded the library and called 开发者_开发知识库the function, passing an email address (from an input box).
The email template exists on the server (as do all relevant files) and the function is in fact returning TRUE, tested by using an IF NOT statement.
However, no emails are being sent. Now I know the CI mail function works, as I made a quick mail using the email library and it sent the message with no problems.
I tested the Ion_Auth library and found it was finding the user and was generating the email using the template, and it is returning TRUE after executing $this->ci->email->send()
So how can this be, when no email is being received?
Instead of altering the default behavior of Ion Auth by editing any Ion Auth files...
As per the CodeIgniter 2 documentation for configuring email sending, do the following...
1) Create a file called located at application/config/email.php
which contains your email settings 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) The in the application/config/ion_auth.php
file, set this value to TRUE
$config['use_ci_email'] = TRUE;
You can change the default ion auth behaviour by rewritting the send email code to native PHP, or you can change the protocol. Go to forgotten_password()
and before $this->ci->email->initialize($config);
you can do $config['protocol'] = OPTION;
where option can be mail
, sendmail
, or smtp
http://codeigniter.com/user_guide/libraries/email.html
Hope this helps
精彩评论