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

[版本 2.x] email类

[复制链接]
发表于 2011-10-3 21:51:44 | 显示全部楼层 |阅读模式
PHP复制代码
<?php
 
 class Index extends CI_Controller {
        function __construct()
        {
          parent::__construct();
          header('Content-Type:text/html;charset=utf-8');
        }
       
        function index()
        {              
        $config['useragent'] = 'CodeIgniter';//用户代理
        $config['protocol'] = 'smtp';//邮件发送协议mail, sendmail, or smtp
        $config['smtp_host'] = 'smtp.qq.com';
        $config['smtp_user'] = '290601953';
        $config['smtp_pass'] = '*********';
        $config['smtp_port'] = 25;
        $config['smtp_timeout'] = 5;
        $config['wordwrap'] = TRUE;
        $config['mailtype'] = 'html';
        $config['charset'] = 'utf-8';
        $config['validate'] = TRUE;
       
        $this->email->initialize($config);
       
        $this->email->from('290601953@qq.com', '蝎紫');
        $this->email->to('751618126@qq.com');
       
        $this->email->subject('Email Test');
        $this->email->message('Testing the email class.');
       
        $this->email->send();
       
        echo $this->email->print_debugger();
       
        }
 
}
复制代码

这是我的代码,我想知道为什么发不出呢?
发表于 2011-10-4 00:28:38 | 显示全部楼层
print_debugger输出啥信息?
发表于 2011-12-7 21:59:48 | 显示全部楼层
我想你邮件可能被QQ邮箱给和谐了,你去垃圾箱看看。
我刚用你代码测试了下,我是成功了。

本版积分规则