Email sending |
[eluser]Volkscom[/eluser]
When I try to send a mail through codeIgniter.I follow the samples in the user guide,then I got this error Fatal error: Call to a member function from() on a non-object in path to my system controller My controller is class Reg_controller extends Controller{ function index(){ $this->load->helper(array("form","html","url",'email')); $this->load->library('form_validation'); $this->load->library('email'); $this->load->language('registration'); $this->load->view('tocheck'); $this->load->database(); $this->load->model('registermodel'); $this->form_validation->set_rules('entry_date', 'Date ', 'required'); if ($this->form_validation->run() == true){ if($this->input->post('utype')=='R'){ $reslt = $this->registermodel->insert_register(); if($reslt==1){ $this->email->from('[email protected]','Our site'); $this->email->to("[email protected]"); $this->email->subject('Email Test'); $this->email->message('Testing the email class in codeIgniter.'); $this->email->send(); echo "[removed] alert('New user is added!..'); [removed]"; } } } } } and I create a config file named email.php in system/application/config/. email.php contains: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* |-------------------------------------------------------------------------- | Email References |-------------------------------------------------------------------------- | | This option allows you to mail send by CodeIgniter. | For more information please see the user guide: | | http://ellislab.com/codeigniter/user-gui.../urls.html */ $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE; ?> Please help me ,I am new in codeIgniter. Thanks in advance |
Messages In This Thread |
Email sending - by El Forum - 07-30-2010, 11:29 PM
Email sending - by El Forum - 07-31-2010, 12:54 AM
|