CI框架有发送邮件类:具体的可以看手册,关于邮件的配置文件,我放在单独的文件里,方便以后维护
文件名为:email.php,这个文件保存到application/config/email.php,然后在控制器里加载$this->load->library("email"),这样就不需要使用$this->email->initialize()函数来初始化参数了
Php代码
$config["protocol"] = "smtp";
$config["smtp_host"] = "smtp.163.com";
$config["smtp_user"] = "email地址";
$config["smtp_pass"] = "*******";
$config["mailtype"] = "html";
$config["validate"] = true;
$config["priority"] = 1;
$config["crlf"] = "\r\n";
$config["smtp_port"] = 25;
$config["charset"] = "gb2312";
$config["wordwrap"] = TRUE;
$config["protocol"] = "smtp";
$config["smtp_host"] = "smtp.163.com";
$config["smtp_user"] = "email地址";
$config["smtp_pass"] = "*******";
$config["mailtype"] = "html";
$config["validate"] = true;
$config["priority"] = 1;
$config["crlf"] = "\r\n";
$config["smtp_port"] = 25;
$config["charset"] = "gb2312";
$config["wordwrap"] = TRUE;
视图关键代码:
Html代码