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

[讨论/交流] email类 进来讨论解答!

[复制链接]
发表于 2016-8-17 16:52:00 | 显示全部楼层 |阅读模式
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.163.com';
$config['smtp_user'] = 'ecenlishadmin@163.com';
$config['smtp_pass'] = '******';
$config['smtp_port'] = '25';
$config['smtp_timeout'] = '5';
$config['newline'] = "/r/n";
$config['charset']='utf-8';  
$this->email->initialize($config);
$this->email->from('ecenlishadmin@163.com', 'Lange');  
$this->email->to('261109149@qq.com');
$subject='test codeigniter email class!';  
$msg='test email send';  

$this->email->subject($subject);
$this->email->message($msg);
$this->email->send();   
echo $this->email->print_debugger();
这是我控制器的方法,但是最后运行后报错了。
220 163.com Anti-spam GT for Coremail System (163com[20141201])
hello: 250-mail250-PIPELINING250-AUTH LOGIN PLAIN250-AUTH=LOGIN PLAIN250-coremail 1Uxr2xKj7kG0xkI17xGrU7I0s8FY2U3Uj8Cz28x1UUUUU7Ic2I0Y2UrOOLuXUCa0xDrUUUUj250-STARTTLS250 8BITMIME
验证密码失败。错误:535错误:身份验证失败  
无法使用PHP发送电子邮件的SMTP。您的服务器可能不被配置为发送邮件使用这种方法。
Failed to authenticate password. Error: 535 Error: authentication failed
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniterDate: Wed, 17 Aug 2016 10:39:27 +0200From: "Lange" <ecenlishadmin@163.com>Return-Path: <ecenlishadmin@163.com>To: 261109149@qq.comSubject: =?utf-8?Q?=74=65=73=74=20=63=6F=64=65=69=67=6E=69=74=65=72=20=65=6D=61=69?= =?utf-8?Q?=6C=20=63=6C=61=73=73=21?=Reply-To: "ecenlishadmin@163.com" <ecenlishadmin@163.com>X-Sender: ecenlishadmin@163.comX-Mailer: CodeIgniterX-Priority: 3 (Normal)Message-ID: <57b422bf41634@163.com>Mime-Version: 1.0Content-Type: text/plain; charset=utf-8Content-Transfer-Encoding: 8bittest email send希望那位老师帮忙看一下。163邮箱的设置我也设置了!
先谢谢了!

 楼主| 发表于 2016-8-17 17:08:15 | 显示全部楼层
上面那个535的报错,说是我密码错误,认证失败!但是我用它登录了一下邮箱是没问题的!什么情况
 楼主| 发表于 2016-8-18 10:37:11 | 显示全部楼层
mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
我是本地发送邮件的,是不是要在php.ini里面修改一些配置呢?
希望知道了老师帮忙看一下!谢谢。在线等!

本版积分规则