benedmunds / CodeIgniter-Ion-Auth

Simple and Lightweight Auth System for CodeIgniter
http://benedmunds.com/ion_auth/
MIT License
2.34k stars 1.14k forks source link

ion Auth email issue #716

Closed gabrielpasv closed 9 years ago

gabrielpasv commented 9 years ago

Hi,

I have read some threads with lots of people having problem with ion auth sending email. I tried to replicated their solution but I still cannot make it to work. After finally install and have ionauth running ok on my ubuntu server, now it's time to test the email validation. But it is not working

see my config

$config['use_ci_email'] = TRUE; // Send Email using the builtin CI email class, if false it will return the code and the identity $config['email_config'] = array( 'protocol' => 'smtp', 'smtp_host' => 'smtp.mandrillapp.com', 'smtp_user' => 'xxxxxx@gmail.com', 'smtp_pass' => 'my_key', 'smtp_port' => 587, 'crlf' => "\r\n", 'newline' => "\r\n" );

I have tested this config and the email was sent just fine. But through ionAuth it just doesn't work.

How can I troubleshoot it ? Where can I add some code to output info ?

Thanks

benedmunds commented 9 years ago

Try using a config/email.php file and see if you get the same results.

gabrielpasv commented 9 years ago

Yeah... I have done it already, didn't work :(

gabrielpasv commented 9 years ago

any idea how can I troubleshoot this? Thanks

rishiforum commented 9 years ago

I have same issue, can any help me?

benedmunds commented 9 years ago

What error do you get if you debug and dump the email error?

gabrielpasv commented 9 years ago

Trying to do that but I am not sure where to add the debug commands

gabrielpasv commented 9 years ago

Sorry benedmunds... seems like a nice lib and lot of people using but this email issue is just driving me crazy. I am building my own login system, Thanks anyway.

benedmunds commented 9 years ago

You can throw the debug code for register() in around here: https://github.com/benedmunds/CodeIgniter-Ion-Auth/blob/2/libraries/Ion_auth.php#L362

If you build your own, just make sure to use PHP 5.4+ and the built in password hashing and verification methods. Need to make sure you're secure.

gabrielpasv commented 9 years ago

I added the code there but it didn't show up anything :(

benedmunds commented 9 years ago

What did you add exactly?

gabrielpasv commented 9 years ago

echo $this->email->print_debugger();

benedmunds commented 9 years ago

Change it to this:

echo 'ci_use_email:'; var_dump($this->config->item('use_ci_email', 'ion_auth')); echo 'Email debugging --'; echo $this->email->print_debugger(); exit;

gabrielpasv commented 9 years ago

It didn't output nothing on screen

See part of the code

            if ($this->email->send() == TRUE) {
                $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful', 'activation_email_successful'));
                $this->set_message('activation_email_successful');
                return $id;

            }
            echo 'ci_use_email:';
            var_dump($this->config->item('use_ci_email', 'ion_auth'));
            echo 'Email debugging --';
            echo $this->email->print_debugger();
            exit;
        }
benedmunds commented 9 years ago

put something inside the if and see if it's hitting that

avenirer commented 9 years ago

If you use a gmail account there might be problems from Google, as the service is not allowing other applications (considered less secure) to use their accounts.

gabrielpasv commented 9 years ago

To send emails I am using mandrill api. And it works outside of ionAuth ... sending emails to gmail and hotmail...

when I use it with ionAuth it doesn't send email. Neither hotmail or gmail

gabrielpasv commented 9 years ago

benedmunds still no output.....

I am tried and will take some rest. Maybe I am doing something wrong and can'tfigure out

avenirer commented 9 years ago

If you use CodeIgniter 3, in the config could you please try to also add: 'smtp_crypto' => 'tls' ?

gabrielpasv commented 9 years ago

I am using 2.2

avenirer commented 9 years ago

then try to change the smtp_host to "ssl://smtp.mandrillapp.com" or "tls://smtp.mandrillapp.com"

gabrielpasv commented 9 years ago

Man... I finally found the problem. I tested mandrill app yesterday and it worked ok. Now somehow they suspended my account and it was not sending any email. :(

I changed to send via gmail and now all it 's working..... yikes....

I wanted to thank you all for the help. Sorry for anything...

gabriel

benedmunds commented 9 years ago

All good, have fun!

Bhavinshah5111 commented 9 years ago

i am having same issue.try all above forgot password mail sent but not received at my gmail account

benedmunds commented 9 years ago

The best thing to do is just to create a test controller method that sends an email to work out the proper email settings.

Bhavinshah5111 commented 9 years ago

problem in config file.but now it works ...sorry for disturbing ...thanks a lot...

benedmunds commented 9 years ago

What was the correct answer? for future users.