2

I've WAMP server setup on local dev environment (php_openssl extension enabled). I installed Code Igniter and trying to configure TankAuth, where I want to use GMail (actually Google Apps) to send test mails.

I went through following URLs for configuration

Based on input from above, I updated _send_email function of tank auth as follow

function _send_email($type, $email, &$data)
{
    $this->load->library('email');

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

    $this->email->initialize($config); 

    $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();

    if ( ! $this->email->send())
    {
        show_error($this->email->print_debugger());
    } else {
        //echo('DONE');        
    } 
}

I'm getting message mail sent.. but actually mail was not sent. Can someone please point-out where I'm doing the mistake?

Popup is also enabled in GMail settings

Community
  • 1
  • 1
Kapil Sharma
  • 10,135
  • 8
  • 37
  • 66

3 Answers3

1

Do not edit the _send_email function in Tank Auth. Instead add

$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.googlemail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "mymail@youthpark.org";//also valid for Google Apps Accounts
$config['smtp_pass'] = "mypass";

to the file "email.php" in your "config" folder.

This worked for me

0

Did you check logs to see if an error es loged?

I use postmark to handle all mail delivery, they have some free sends and also there is a spark for CI.

I use in my setup start for new projects. check it:

https://github.com/ramirors/DD-Auth

RamiroRS
  • 461
  • 3
  • 4
  • Thanks for reply Ramiro. No error shown in logs file. Being a commercial solution, postmark will not fit on my project as I'm working on opensource project. I'm trying auth libs and definitely try DDAuth too but not because I'm, till now, not able to configure TankAuth. – Kapil Sharma Oct 25 '12 at 22:14
0

I had the same problem. The following _send_email function, along with removing /application/config/email.php, worked for me:

function _send_email($type, $email, &$data)
{       
    $config['protocol'] = 'smtp'; 
    $config['smtp_host'] = 'ssl://smtp.googlemail.com'; 
    $config['smtp_port'] = 465; 
    $config['smtp_user'] = 'my.email.address@gmail.com'; 
    $config['smtp_pass'] = 'NiceTry'; 
    $config['mailtype'] = 'html';

    $this->load->library('email', $config); 

    $this->email->set_newline("\r\n"); 

    $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));

    if ($this->email->send()) { 
        echo "Sent!"; 
    } else { 
        echo "FAILED"; 
    } 

}

Tank Auth Email Problem got me started down the right path.

Keyslinger
  • 4,903
  • 7
  • 42
  • 50