php - CodeIgniter generates error when sending email -
i amusing code below send email using codeigniter keep getting error
unable send email using php mail(). server might not configured send mail using method.
$this->email->from("kariuki.john@gmail.com", "name"); $this->email->to('johnkariukin@gmail.com'); $this->email->cc('contact@johnkariuki.co.ke'); $this->email->subject("new email on johnkariuki.co.ke"); $this->email->message("abdfdfj\nfdgdfgdf"); if($this->email->send()) { echo "works"; } else { $this->email->print_debugger(); }
what issue? cannot find working solution online. issue? cannot find working solution online. have loaded email library in constructor
by default, email protocol set 'mail', may need switch 'sendmail' instead.
$config['protocol'] = 'sendmail'; $this->email->initialize($config);
this require install sendmail on server (sudo apt-get install sendmail
if you're on ubuntu).
$this->email->send()
uses php's builtin mail()
function, , according this post may trying use sendmail if protocol isn't explicitly set 'sendmail'.
Comments
Post a Comment