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

[HELP] 关于email

[复制链接]
发表于 2012-5-28 15:50:35 | 显示全部楼层 |阅读模式
ci自带的Email类连接smtp.qq.com,连接不上,然后我就下载了一个phpmailer,配置完成后,执行程序,出现Could not instantiate mail function.错误。有谁知道问题出在哪吗?先谢谢了
发表于 2012-5-28 17:29:22 | 显示全部楼层
qq邮箱怎么会连不上呢,试试下面的
PHP复制代码
$config = array(
        'crlf'          => "\r\n",
        'newline'       => "\r\n",
        'charset'       => 'utf-8',
        'protocol'      => 'smtp',
        'mailtype'      => 'text',
        'smtp_host' => 'smtp.qq.com',
        'smtp_port' => '25',
        'smtp_user' => 'qq号',
        'smtp_pass' => 'qq密码'
);
 
$this->load->library('email', $config);
 
$this->email->from('qq邮箱', 'Your Name');
$this->email->to('qq邮箱');
 
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
 
$this->email->send();
 
echo $this->email->print_debugger();
复制代码

发表于 2014-6-23 17:42:45 | 显示全部楼层
530098379 发表于 2012-5-29 09:25
哈哈,终于弄出来,是你给我发的东西,  
        'crlf'          => "rn",
        'newline'       => ...

同样的问题,解决了。
 楼主| 发表于 2012-5-28 16:30:12 | 显示全部楼层
       require_once('PHPMailer_v5.0.2/class.phpmailer.php');

        // the true param means it will throw exceptions on errors, which we need to catch
        $this->mail = new PHPMailer(true);
       PHPMailer,这个类不能实例化
 楼主| 发表于 2012-5-28 17:52:44 | 显示全部楼层
qi_ruo 发表于 2012-5-28 17:29
qq邮箱怎么会连不上呢,试试下面的

fsockopen() [function.fsockopen]: unable to connect to smtp.qq.com:25 (対象のコンピュータによって拒否されたため、接続できませんでした。 ),貌似不支持fsockopen()方法啊
发表于 2012-5-28 18:25:12 | 显示全部楼层
登录QQ邮箱,查看帐户设置,看是否已开启POP3/SMTP服务
 楼主| 发表于 2012-5-28 18:32:37 | 显示全部楼层
乌有 发表于 2012-5-28 18:25
登录QQ邮箱,查看帐户设置,看是否已开启POP3/SMTP服务

开启了
 楼主| 发表于 2012-5-28 18:33:37 | 显示全部楼层
qi_ruo 发表于 2012-5-28 17:29
qq邮箱怎么会连不上呢,试试下面的

哦,我没关杀毒,关了以后页面走到一半卡死了,也没发送成功
发表于 2012-5-28 18:39:47 | 显示全部楼层
530098379 发表于 2012-5-28 18:33
哦,我没关杀毒,关了以后页面走到一半卡死了,也没发送成功

crlf和newline中 r 和 n 前面都要加\转义 你看下拷贝的时候是不是没有加上
发表于 2012-5-28 18:47:32 | 显示全部楼层
使用$this->email->print_debugger()来看一下有没什么提示线索了.
看你上面发的提示都是说连接不上.以前有碰过一些网络环境被屏蔽的情况,只能使用pop3不能使用smtp
 楼主| 发表于 2012-5-29 09:25:55 | 显示全部楼层
qi_ruo 发表于 2012-5-28 18:39
crlf和newline中 r 和 n 前面都要加\转义 你看下拷贝的时候是不是没有加上

哈哈,终于弄出来,是你给我发的东西,  
        'crlf'          => "rn",
        'newline'       => "rn",
改成
        'crlf'          => "/r/n",
        'newline'       => "/r/n",
就好了!太爽了!

本版积分规则