php - Codeigniter $this->email->send() not working while mail() does -


i can't figure out why if try use ci email class doesn't send emails, while if use native php mail() class works.

has noted "email sent" while not sent , error "my server not setup".

i tried figure out how set but... nothing...

controller code follows:

 if($this->form_validation->run()){                  //set language                 $this->lang->load('site', $this->session->userdata('lang'));                  //random key                 $user_valid_key = md5(uniqid());                  //prepare email                 $this->load->library('email', array('mailtype' => 'html'));                 $this->email->from($this->config->item('email_signup_from'), 'wondermark.net');                 $this->email->to($this->input->post('email'));                 $this->email->subject($this->lang->line('email_signup_subject'));                  //format mail con %s per inserire campi necessari                 $signup_msg = sprintf($this->lang->line('email_signup_message'), $this->input->post('fname'), base_url().'main/signup_confirm/'.$user_valid_key);                  $this->email->message((string)$signup_msg);                  if($this->email->send()){                     //todo: load view...                     echo "email sent";                 }else{                     $to = $this->input->post('email');                     mail($to, 'test', 'other sent option failed');                     echo $this->input->post('email');                     show_error($this->email->print_debugger());                 }                  //todo: add db              }else{              // form validation failed  } 

use setup email..

$this->load->library('email');  $config['protocol']    = 'smtp';  $config['smtp_host']    = 'ssl://smtp.gmail.com';  $config['smtp_port']    = '465';  $config['smtp_timeout'] = '7';  $config['smtp_user']    = 'sender_mailid@gmail.com';  $config['smtp_pass']    = 'password';  $config['charset']    = 'utf-8';  $config['newline']    = "\r\n";  $config['mailtype'] = 'text'; // or html  $config['validation'] = true; // bool whether validate email or not        $this->email->initialize($config);   $this->email->from('sender_mailid@gmail.com', 'sender_name'); $this->email->to('recipient@gmail.com');    $this->email->subject('email test');  $this->email->message('testing email class.');    $this->email->send();  echo $this->email->print_debugger(); 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -