我做簡單的表格用戶提交電子郵件和城市提交表格和發送電子郵件給我的用戶感謝我的網站上godaddy,當我提交它顯示錯誤。 1-發送電子郵件錯誤 2- $電子郵件輸入沒有得到 建議我共享代碼。Codeigniter - 面對問題發送電子郵件和輸入用戶電子郵件
user.php的控制器
public function sendUserMail($email) {
$this->load->library('email');
$email = $this->input->get("email");
$this->email->from('[email protected]', 'Halalat');
$this->email->to('$email');
$this->email->subject('Halalat Newsletter Subscription');
$this->email->message('Testing');
//$this->email->attach('/assests/images/photo1.jpg');
$this->email->send();
echo $this->email->print_debugger();
}
在CONFIG夾i使email.php
<?php
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'host.abc.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'abc';
$config['charset'] = 'utf-8';
$config['mailtype'] = 'html';
$config['newline'] = "\r\n";
?>
user_model.php在模型
function create_member()
{
$new_member_insert_data = array(
'email' => $this->input->post('email'),
'city' => $this->input->post('city'),
);
$insert = $this->db->insert('users', $new_member_insert_data);
return $insert;
} //create_member
請也張貼錯誤信息。 –