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

[eluser]Unknown[/eluser]
Hello,

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

Code:
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();
}

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

[eluser]XMadMax[/eluser]
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.

http://ellislab.com/codeigniter/user-gui...email.html

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