用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3124|回复: 2
收起左侧

[HELP] CI里email类 smtp发送不出邮件,求助,附源码

[复制链接]
发表于 2013-3-16 08:25:18 | 显示全部楼层 |阅读模式
                $this->load->library('email');            //加载CI的email类
               
                //以下设置Email参数
                $config['protocol'] = 'smtp';
                $config['smtp_host'] = 'smtp.qq.com';
                $config['smtp_user'] = '*******';
                $config['smtp_pass'] = '*******';
                $config['smtp_port'] = '25';
                $config['charset'] = 'utf-8';
               
                $this->email->initialize($config);
       
                //以下设置Email内容
                $this->email->from('549193902@qq.com', 'test');
                $this->email->to('1020332177@qq.com');
                $this->email->subject('Email Test');
                $this->email->message('<font color=red>Testing the email class.</font>');
                //$this->email->attach('application\controllers\1.jpeg');           //相对于index.php的路径
                if($this->email->send())
                {
                        echo'sss';
                }else{
                        echo'ssaaaaaaaaaaaas';
                }                                                 smtp帐号没错







 楼主| 发表于 2013-3-16 10:32:20 | 显示全部楼层
up!!!!!!!!!!!
发表于 2013-3-18 11:02:26 | 显示全部楼层
加上这两行试试:
PHP复制代码
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
复制代码

本版积分规则