0
我試圖使用codeigniter發送電子郵件功能,但它不起作用,沒有發送,有任何幫助?如何發送郵件使用Codigniter?
這是我的控制器:
public function send_mail() {
$this->load->library('session');
$this->load->helper('form');
$this->load->view('admin/main/email_form.php');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'xxxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE);
$from_email = "[email protected]";
$to_email = $this->input->post('email');
$subject = $this->input->post('subject');
$message = $this->input->post('message');
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from($from_email);
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
}
你有沒有做過任何疑難解答?看着日誌?試過任何其他設置? – Sparky
如果您使用本地主機,則可能需要配置您的php.ini文件和sendmail.ini https://www.youtube.com/watch?v=TO7MfDcM-Ho – user4419336