I'm Beginner for the CI.
Here is my code in welcome.php
class Welcome extends CI_Controller {
public function index()
{
$this->load->helper('url');
$this->load->view('welcome_message');
}
public function emailSend()
{
$this->load->library('upload');
$this->load->library('email');
$config['upload_path'] = 'uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$this->upload->initialize($config);
$this->email->from($this->input->post('from'), $this->input->post('name'));
$this->email->to('taryar.t1@gmail.com');
//$this->email->cc('another@another-example.com');
//$this->email->bcc('them@their-example.com');
$this->email->subject($this->input->post('subject'));
$this->email->message($this->input->post('body'));
if($this->upload->do_upload())
{
$attachdata=$this->upload->data();
$this->email->attach($attachdata['full_path']);
}
if($this->email->send())
{
echo 'Your email was sent, successfully.';
}
else
{
show_error($this->email->print_debugger());
}
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
This code is only work for text and not for the attachment(image). The error is "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."
how can i fixed that error?? Help me Thz you.