php - Codeigniter email class not working


I tried the code below. At one time the code was working fine. I was able to send the emails. After a few minutes, when I tried it again without even changing anything, I get this error messageUnable to send email using PHP mail(). Your server might not be configured to send mail using this method.

I dont know whats wrong. Lately I am facing a lot of similar bugs with codeigniter.

public function email($message = NULL, $subject=NULL, $email=NULL){
            $to = $this->session->userdata('email');
            $to = $email;

        $this->email->from('[email protected]', 'Mydomain');





i face this problem and work hard and i find solution this

just little change in email config its working 100%

 $config['protocol'] = 'ssmtp';
 $config['smtp_host'] = 'ssl://';



I added the following lines and the mail is working again.

$config['protocol'] = 'sendmail';
            $config['mailpath'] = '/usr/sbin/sendmail';
            $config['charset'] = 'iso-8859-1';
            $config['wordwrap'] = TRUE;


People are also looking for solutions to the problem: php - Jquery .autocomplete not working after ajax call


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.