Welcome Guest, Not a member yet? Register   Sign In
How to send email via Codeigniter? I'm using NameCheap's Open-Xchange server..


I want to send an email if the user forgot his password. But it is not sending using my code:

function _send_email($type, $email, &$data)
  $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->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));

What else do I need to set up to make this work?

Hey alcatraz, you must to define email.php in the config file, with smtp protocolo, port user and password used to connect your remote mail server.


Example of email.php file ussing google account:

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '10';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'mygooglepassword';

Theme © iAndrew 2016 - Forum software by © MyBB