试了好多个网站上的版本,都不行,自己亲自用163的邮箱发送成功了。(邮箱服务器需要多换几个试试,有时候服务器也是关键。 此版本在XP,WIND2003下测试都没问题)
function email(){
$this->load->library('email'); //加载CI的email类
//以下设置Email参数
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.163.com';
$config['smtp_user'] = '15300330047'; //用户名
$config['smtp_pass'] = 'your_password****';
$config['smtp_port'] = '25';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
//以下设置Email内容
$this->email->from('15300330047@163.com', 'ZD');
$this->email->to('280025995@qq.com');
$this->email->subject('10月17日email测试');
$this->email->message('用。。框架email发送器,发送');
//$this->email->attach('application\controllers\1.jpeg'); //可发送图片,相对于index.php的路径
$this->email->send();
echo $this->email->print_debugger(); //返回包含邮件内容的字符串,包括EMAIL头和EMAIL正文。用于调试。
//if(!$this->email->send()){
// echo "error ...."."<br>".$this->email->print_debugger();
//}else{
// echo "Message sent! 恭喜,邮件发送成功!";
//}
}
CI框架发送邮件
最新推荐文章于 2016-09-27 09:54:04 发布