【发布时间】:2015-06-01 11:50:12
【问题描述】:
该脚本在我的本地主机(Xampp,mac lion)中完美运行。将网站上传到免费的远程主机http://cp1.runhosting.com/ 以及我的脚本尝试使用它给出此错误的电子邮件类的所有部分(标题中提到)。有什么想法吗?
//send_email_helper
function send_email($user_email,$subject,$msg){
$i = & get_instance();
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'myemail@gmail.com',
'smtp_pass' => 'mypassword',
'mailtype' => 'html',
//'charset' => 'iso-8859-1',
'charset' => 'utf-8',
'wordwrap' => TRUE
);
$i->load->library('email', $config);
$i->email->set_newline("\r\n");
$i->email->from('myemail@gmail.com','My Name');
$i->email->to($user_email);
$i->email->subject($subject);
$i->email->message($msg);
if($i->email->send()){
return true;
}else{
return false;
}
}
//function call in controller
function process(){
$this->load->helper('send_email_helper');
$user_email = $this->filterdata($this->input->post('email'));
$message = "test message blah blah...";
$subject = "test subject";
$data['email_sent'] = false;
if(send_email($user_email,$subject,$message)){
$data['email_sent'] = true;
}else{
$data['email_sent'] = false;
}
$data['chat_client'] = $this->session->userdata('chat_client');
$this->load->view('confirmation',$data);
}
【问题讨论】:
-
你在哪里加载你的电子邮件库??在您的代码中向我们展示!
-
刚刚编辑了问题
标签: php codeigniter email