-2

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 message Unable 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){
        if(!isset($email)){
            $to = $this->session->userdata('email');
        }else{
            $to = $email;
        }
        $this->load->library('email');


        $this->email->from('noreply@mydomain.com', 'Mydomain');
        $this->email->to($to); 

        $this->email->subject($subject);
        $this->email->message($message);    

        $this->email->send();
    }
4

2 回答 2

1

我面对这个问题并努力工作,我找到了解决方案

电子邮件配置几乎没有变化,其工作 100%


 $config['protocol'] = 'ssmtp';
 $config['smtp_host'] = 'ssl://ssmtp.gmail.com';
于 2015-04-30T10:09:53.337 回答
0

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;

            $this->email->initialize($config);
于 2013-05-15T09:20:26.000 回答