Codeigniter Tank Auth not sending activation Email

1.2k Views Asked by At

I am using Tank Auth with codeigniter for Email verification of user on registration. After registering it is showing "Registered successfully. Check your activation email." But I am not recieving any activation Email.

Settings I am using in Application/config/email.php are as follows:

 $config['protocol'] = "smtp";
 $config['smtp_host'] = "ssl://smtp.googlemail.com";
 $config['smtp_port'] = "465";
 $config['smtp_user'] = "My Gmail";//also valid  Google Apps Accounts
 $config['smtp_pass'] = "My Password";
 $config['mailtype'] = 'html';
 $config['charset'] = 'utf-8';
 $config['newline'] = "\r\n";

This default mail function used by TankAuth in Controller:

function _send_email($type, $email, &$data)
    {
        $this->load->library('email');
        $this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
        $this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
        $this->email->to($email);
        $this->email->subject(sprintf($this->lang->line('auth_subject_'.$type), $this->config->item('website_name', 'tank_auth')));
        $this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));
        $this->email->set_alt_message($this->load->view('email/'.$type.'-txt', $data, TRUE));
        $this->email->send();
    }

Do I need to do anything else? As I am not recieving any activation emails using these settings.

Thanks in advance.

1

There are 1 best solutions below

1
DShah On

Try the below settings:

$config['protocol'] = 'smtp';
$config['charset'] = 'iso-8859-1';
$config['mailtype'] = 'html';

$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';

$config['smtp_user'] = 'My Gmail';
$config['smtp_pass'] = 'My Password';

And in send mail function, add set the new line code before 'from'

$this->email->set_newline("\r\n");
$this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));