I'm using WAMP Server on windows 7 and trying to configure Tank Auth with code Igniter.
While registration, Screen stuck on browser. I checked database that user was successfully inserted. With some debug, I was able to find that code is getting stuck while sending mail in _send_email
function on Tank Auth's controller. Below is the code with debug statements.
function _send_email($type, $email, &$data)
{
echo "In _send_email";
$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));
echo "Before Sending";//exit;
$this->email->send();
echo "Mail Sent";
echo $this->email->print_debugger();exit;
}
When I put exit
before $this->email->send();
, code worked fine but stuck as soon as I remove that exit. Clear indication that send() method is having problems.
I wrote another cotroller to test email as follow
public function view($slug){
$this->load->library('email');
$this->email->from('Myemail1', 'Kapil Sharma');
$this->email->to('myemail2');
$this->email->set_newline("\r\n");
$this->email->subject('Email Test');
$this->email->message('Testing the email class.<br>New Line.<br><strong>Strong</strong>');
$this->email->send();
$data['title'] = $data['news']['title'];
$this->load->view('templates/header', $data);
$this->load->view('news/view.html', $data);
$this->load->view('templates/footer');
}
Which sent the mail successfully. Here is my email.php config, if needed
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'myemail@gmail.com', //This is correct
'smtp_pass' => 'mypassword', //This is correct
'mailtype' => 'html'
);
Can someone please identify what is the issue. Why sending email is not working in Tank Auth's Controller but working fine in another test controller. I cross checked both tank auth config file and english under lang is available.
Update
I updated subject line in _send_email
as follow
//$this->email->subject(sprintf($this->lang->line('auth_subject_'.$type),$this->config->item('website_name', 'tank_auth')));
$this->email->subject('Test sub');
and code is working now. It seems there is some problem with lang. Checking if I can figure out the issue. Can someone quickly suggest why there is issue in $this->lang->line
method.