php codeigniter email library -
i'm having trouble here. why can't send email using smtp? error looks this.
the code looks this
$config = array( 'protocol' => 'smtp', 'smtp_host' => 'mail.email.com', 'smtp_port' => 25, 'smtp_user' => 'admin@email.com', 'smtp_pass' => 'pass' ); $this->email->initialize($config); $this->email->cc('admin@provider.net'); $this->email->set_mailtype('html'); $this->email->from('admin@provider.net', 'admin'); $this->email->send(); if(!$this->email->send()) { show_error($this->email->print_debugger()); }
code update:
$this->load->library('email'); $config = array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'account@gmail.com', 'smtp_pass' => 'password', 'smtp_timeout' => '4', 'mailtype' => 'html', 'charset' => 'iso-8859-1' ); $this->email->initialize($config); $this->email->set_newline("\r\n"); //$this->email->set_mailtype('html'); $this->email->cc('admin@email.co.id'); $this->email->from('admin@email.co.id', 'admin'); $this->email->to('email@email.com'); $this->email->subject('test online'); $this->email->message('test email'); if(!$this->email->send()) { echo $this->email->print_debugger(); } else { echo 'sent'; }
and returned message.
unable send email using php mail(). server might not configured send mail using method.
try put smtp_port parameter '465' in quotes , change same address account using send mail.
Comments
Post a Comment