/**
*编码为utf-8
*
*/
<?php
class Sendmail extends Controller {
function Sendmail(){
parent::Controller();
}
function mail()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.qq.com',//服务器
'smtp_port' => '25',
'smtp_user' => '68155123@qq.com',//from
'smtp_pass' => 'houryh3035',//password
'mailtype' => 'html',//邮件类型
'charset' => 'utf-8'//编码
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$from_name = "华领网络";//发件人名称
$email_subject = "GPS上客户登记:";//标题
$email_body = "士大夫论文242sdfl;sfl";//内容
//解决中文乱码问题
$from_name = iconv('GB2312','UTF-8',$from_name);//编码转换,把gb2312转换成utf-8
$email_subject = iconv('GB2312','UTF-8',$email_subject);
$email_body = iconv('GB2312','UTF-8',$email_body);
$this->email->from('68155123@qq.com', $from_name);
$this->email->to('281904975@qq.com');//to
$this->email->subject($email_subject);
$this->email->message($email_body);
if (!$this->email->send())
{
show_error($this->email->print_debugger());
return false;
}
else
{
return true;
}
}
}
?>
本文来自:http://hi.baidu.com/ssfnadn/blog/item/d25d5fc488d4f0af8226acb9.html
另外:
如果icnov 不能使用参考:
http://www.jb51.net/article/14530.htm
http://apps.hi.baidu.com/share/detail/1797448