530098379 发表于 2012-5-28 15:50:35

关于email

ci自带的Email类连接smtp.qq.com,连接不上,然后我就下载了一个phpmailer,配置完成后,执行程序,出现Could not instantiate mail function.错误。有谁知道问题出在哪吗?先谢谢了

qi_ruo 发表于 2012-5-28 17:29:22

qq邮箱怎么会连不上呢,试试下面的$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();

askswin 发表于 2014-6-23 17:42:45

530098379 发表于 2012-5-29 09:25
哈哈,终于弄出来,是你给我发的东西,
      'crlf'          => "rn",
      'newline'       => ...

同样的问题,解决了。

530098379 发表于 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,这个类不能实例化

530098379 发表于 2012-5-28 17:52:44

qi_ruo 发表于 2012-5-28 17:29 static/image/common/back.gif
qq邮箱怎么会连不上呢,试试下面的

fsockopen() : unable to connect to smtp.qq.com:25 (対象のコンピュータによって拒否されたため、接続できませんでした。 ),貌似不支持fsockopen()方法啊

乌有 发表于 2012-5-28 18:25:12

登录QQ邮箱,查看帐户设置,看是否已开启POP3/SMTP服务

530098379 发表于 2012-5-28 18:32:37

乌有 发表于 2012-5-28 18:25 static/image/common/back.gif
登录QQ邮箱,查看帐户设置,看是否已开启POP3/SMTP服务

开启了

530098379 发表于 2012-5-28 18:33:37

qi_ruo 发表于 2012-5-28 17:29 static/image/common/back.gif
qq邮箱怎么会连不上呢,试试下面的

哦,我没关杀毒,关了以后页面走到一半卡死了,也没发送成功

qi_ruo 发表于 2012-5-28 18:39:47

530098379 发表于 2012-5-28 18:33 static/image/common/back.gif
哦,我没关杀毒,关了以后页面走到一半卡死了,也没发送成功

crlf和newline中 r 和 n 前面都要加\转义 你看下拷贝的时候是不是没有加上

乌有 发表于 2012-5-28 18:47:32

使用$this->email->print_debugger()来看一下有没什么提示线索了.
看你上面发的提示都是说连接不上.以前有碰过一些网络环境被屏蔽的情况,只能使用pop3不能使用smtp

530098379 发表于 2012-5-29 09:25:55

qi_ruo 发表于 2012-5-28 18:39 static/image/common/back.gif
crlf和newline中 r 和 n 前面都要加\转义 你看下拷贝的时候是不是没有加上

哈哈,终于弄出来,是你给我发的东西,
      'crlf'          => "rn",
      'newline'       => "rn",
改成
      'crlf'          => "/r/n",
      'newline'       => "/r/n",
就好了!太爽了!
页: [1] 2
查看完整版本: 关于email