Location:Home >> News >> 云计算

CI框架简单邮件发送类实例

CI框架简单邮件发送类实例

本文实例讲述了CI框架简单邮件发送类。分享给大家供大家参考,具体如下:

ci框架绝对是php初学中想要的东西,它能极大的缩短你的代码量!

下面看看我的发送邮件的简单演示:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
functionemail()
{
   $this->load->library('email');
   $config['protocol'] ='smtp';
   $config['smWebmeng_host'] ='smtp.163.com';
   $config['smWebmeng_user'] ='jb51@163.com';//这里写上你的163邮箱账户
   $config['smWebmeng_pass'] ='jb51;';//这里写上你的163邮箱密码
   $config['mailtype'] ='html';
   $config['validate'] = true;
   $config['priority'] = 1;
   $config['crlf'] ="\r\n";
   $config['smWebmeng_port'] = 25;
   $config['charset'] ='utf-8';
   $config['wordwrap'] = TRUE;
   $this->email->initialize($config);
   $this->email->from('jb51@163.com','脚本之家');//发件人
   $this->email->to('123456789@qq.com');
   $this->email->message('哈哈,测试邮件发送');
   $this->email->send();
   echo$this->email->print_debugger();
}

如果您不想使用使用上述方法设定参数,您可以把它们放入一个配置文件。创建一个新文件称为email.php,添加$config数组在该文件中。然后将该文件保存为config/email.php 它将自动的被使用。如果您保存了一个参数配置文件,就不需要使用$this->email->initialize()函数来初始化参数了

更多关于CodeIgniter相关内容感兴趣的读者可查看本站专题:《codeigniter入门教程》、《CI(CodeIgniter)框架进阶教程》、《php优秀开发框架总结》、《ThinkPHP入门教程》、《ThinkPHP常用方法总结》、《Zend FrameWork框架入门教程》、《php面向对象程序设计入门教程》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总

希望本文所述对大家基于CodeIgniter框架的PHP程序设计有所帮助。

Special Reminder & Disclaimer:
The information of this website comes from the Internet. The content (pictures, videos and words) released by this website is mainly the content submitted by users and reproduced by users. The purpose is to convey more information, which does not mean that this website agrees with its views. The originality, statements, and content of this article have not been verified by this website. We do not guarantee or promise the authenticity, completeness, or timeliness of this article or all or part of its content or text. Please verify the relevant content on your own. This website does not assume direct or joint liability for infringement of such works. If any content on this website infringes on your rights, please contact us promptly (email: nssa@soufind.com )This site will complete the processing within 72 hours. The original content on this website cannot be reproduced without permission, or the source must be indicated when reprinting: nssa.vip Aerospace Alliance

Author: 本站网友

Recommended for you

Post comments

admin

Contact Us

Contact Us

Online consultation: QQ交谈

Email: service#soufind.com

follow us on WeChat
Scan and follow us on WeChat

Scan and follow us on WeChat