Unable to send email from CodeIgniter -


i using codeigniter v3.1.4.in website have 'contact us' page email sending function not working @ all.the strangest thing exact code working in 1 of project while not in project.

$this->email->send()  

the above line executes not send emails.neither show error messages.however, if 'from' address & 'to' address same like(info@mywebsite.org) send mail itself.when 'from' address (user@gmail.com) , 'to' address (info@mywebsite.org), not work.

the code using send email is:

$this->form_validation->set_rules('sender_name', 'name', 'required'); $this->form_validation->set_rules('sender_email', 'enter email', 'required|valid_email'); $this->form_validation->set_rules('mail_subject', 'subject', 'required'); $this->form_validation->set_rules('mail_message', 'your message', 'required');  if (isset($_post) && !empty($_post)) {     if ($this->form_validation->run() == true)     {         $this->email->from($this->input->post('sender_email'), $this->input->post('sender_name'));         $this->email->to("info@mywebsite.org");         $this->email->subject($this->input->post('mail_subject'));         $this->email->message($this->input->post('mail_message'));          if($this->email->send()){             $this->session->set_flashdata('success', 'thanks writing us.you hear shortly.');         }         else         {             $this->session->set_flashdata('error', 'your message not sent.');         }     } } 

i tried implement other solutions here in stackoverflow, none of them working.please me.

first check static data

$this->load->library('email');  $this->email->from('your@example.com', 'your name'); $this->email->to('someone@example.com'); $this->email->subject('email test'); $this->email->message('testing email class.');  $this->email->send(); echo "<pre>status<br>"print_r($this->email->print_debugger());die; 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -