1.需求

发送邮件

2.介绍

使用CI框架的email类库发送邮件,这里演示QQ和163

3.163使用教程

a.先去163邮件开启smtp邮件。

b.在CI的控制器里写下面的代码

$this->load->library('email');            //加载CI的email类

        $config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.163.com';
$config['smtp_user'] = '18367724000@163.com';//这里写上你的163邮箱账户
$config['smtp_pass'] = 'storecode8881111';//这里写上你的163邮箱密码
$config['mailtype'] = 'html';
$config['validate'] = true;
$config['priority'] = 1;
$config['crlf'] = "\r\n";
$config['smtp_port'] = 25;
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$this->email->initialize($config); //以下设置Email内容
$this->email->from('18367724000@163.com', 'mike');
$this->email->to('3090333013@qq.com');
$this->email->subject('Email Test');
$this->email->message('<font color=red>Testing the email class.</font>');
$this->email->attach('application\controllers\1.jpeg'); //相对于index.php的路径 $this->email->send();

4.QQ使用教程

a.先去qq邮件开启smtp邮件。

b.在CI的控制器里写下面的代码

$this->load->library('email');            //加载CI的email类

        //以下设置Email参数
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.qq.com';
$config['smtp_user'] = '100000356@qq.com';
$config['smtp_pass'] = 'dxwgjbziifqhbggj';
$config['smtp_port'] = '465';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$config['newline'] = PHP_EOL;
$config['crlf'] = PHP_EOL;
$this->email->initialize($config); //以下设置Email内容
$this->email->from('18367724000@163.com', 'mike');
$this->email->to('3090333013@qq.com');
$this->email->subject('Email Test');
$this->email->message('<font color=red>Testing the email class.</font>');
$this->email->attach('application\controllers\1.jpeg'); //相对于index.php的路径 $this->email->send();

阿里云ecs关闭25端口的,要用163的465端口来发送

  $this->load->library('email');            //加载CI的email类
$smtp= $this->config->item("smtp");
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.163.com';
$config['smtp_user'] = $smtp['user'];//这里写上你的163邮箱账户
$config['smtp_pass'] = $smtp['password'];//这里写上你的163邮箱密码
$config['mailtype'] = 'html';
$config['validate'] = true;
$config['priority'] = 1;
$config['crlf'] = "\r\n";
$config['smtp_port'] = 465;
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$this->email->initialize($config); //以下设置Email内容
$this->email->from('18360@163.com', 'mike');
$this->email->to($smtp['receiver']);
$this->email->subject($subject);
$this->email->message($message); $result = $this->email->send();

  

单独可以使用的!!!!!

http://blog.csdn.net/qq_16542775/article/details/47817679

5.总结

要注意先开启smtp功能才能发短信,密码是开启之后提供的,而不是邮件的登录密码。

参考资料:http://www.phpddt.com/mvc/79.html

https://www.ipbbs.net/viewtopic.php?pid=119

php使用CI发送qq和163邮件的更多相关文章

  1. java邮件发送 qq与163邮箱互发和qq和163邮箱发送其他邮箱实例

    研究了近一天的时间,通过查阅相关资料,终于对java发送邮件的机制,原理有了一点点的理解,希望能够帮到大家! 1.首先要向你的项目里导入1个jar包:mail-1.4.4.jar即可(实现qq和163 ...

  2. Thinkphp3.2 PHPMailer 发送 QQ邮箱 163邮箱

    在进入正题这前先看下网易(163)邮箱的服务器地址和端口号 类型 服务器名称 服务器地址 SSL协议端口号 非SSL协议端口号 收件服务器 POP pop.163.com 995 110 收件服务器 ...

  3. CI框架使用PHPmail插件发送QQ邮件:

    有助请顶,不好请评.0:33 2016/3/12CI框架使用PHPmail插件发送QQ邮件:发送成功,不过修改了主机参数,还包含了一个phpmail中的一个另外的文件,详见下方:参见:http://c ...

  4. C# QQ & 163 邮件发送

    这篇文章的目的并不是说明如果进行右键的发送,因为在.net 坝坝的怀抱下邮件发送的功能实现并不会很难,当然邮件发送的代码,还是会贴上的,昨天在写一个邮件发送的功能,我直接找到了原来的代码,想着直接就可 ...

  5. 使用python发送163邮件 qq邮箱

    使用python发送163邮件 def send_email(title, content): import smtplib from email.mime.multipart import MIME ...

  6. 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明

    13:40 2015/11/20 5分钟 wamp下php phpmaile发送qq邮件 2015最新方法说明 关键点:现在qq邮箱开通smtp服务后会给你一个很长的独立新密码,发邮件配置中的密码需要 ...

  7. 利用Python+163邮箱授权码发送带附件的邮件

    背景 前段时间写了个自动爬虫的脚本,定时在阿里云服务器上执行,会从某个网站上爬取链接保存到txt文本中,但是脚本不够完善,我需要爬虫完毕之后通过邮件把附件给我发送过来,之前写过一个<利用Pyth ...

  8. Laravel自带SMTP邮件组件实现发送邮件(QQ、163、企业邮箱都可)

    Laravel自带SMTP邮件组件实现发送邮件(QQ.163.企业邮箱都可)     laravel自带SMTP邮件配置和遇到的坑 laravel自带SwiftMailer库,集成了多种邮件API,可 ...

  9. flask_mail发送163邮件,报553错误的原因

    最近在练习用flask_mail发送163邮件时报错: reply: '553 authentication is required,163 smtp9,DcCowAD3eEQZ561caRiaBA- ...

随机推荐

  1. Jenkins 安装的HTML Publisher Plugin 插件无法展示ant生成的JunitReport报告

    最近在做基于jenkins ant  junit 的测试持续集成,单独ant junit生成的junitreport报告打开正常,使用Jenkins的HTML Publisher Plugin 插件无 ...

  2. Docker笔记一:基于Docker容器构建并运行 nginx + php + mysql ( mariadb ) 服务环境

    首先为什么要自己编写Dockerfile来构建 nginx.php.mariadb这三个镜像呢?一是希望更深入了解Dockerfile的使用,也就能初步了解docker镜像是如何被构建的:二是希望将来 ...

  3. 解决PHP-问题:Class 'SimpleXMLElement' not found in

    1.问题 在ubuntu 16.10中,学习PHP,学习到PHP如何生成XML文件时候,碰到了这个问题: PHP Fatal error: Class 'ClassName\SimpleXMLElem ...

  4. Phoenix综述(史上最全Phoenix中文文档)

    个人主页:http://www.linbingdong.com 简书地址:http://www.jianshu.com/users/6cb45a00b49c/latest_articles 网上关于P ...

  5. PhotoView实现图片随手势的放大缩小的效果

    项目需求:在listView的条目中如果有图片,点击条目,实现图片的放大,并且图片可以根据手势来控制图片放大缩小的比例.类似于微信朋友圈中查看好友发布的照片所实现的效果. 思路是这样的:当点击条目的时 ...

  6. 深入研究Visual studio 2017 RC新特性

    在[Xamarin+Prism开发详解三:Visual studio 2017 RC初体验]中分享了Visual studio 2017RC的大致情况,同时也发现大家对新的Visual Studio很 ...

  7. C++随笔:从Hello World 探秘CoreCLR的内部(1)

    紧接着上次的问题,上次的问题其实很简单,就是HelloWorld.exe运行失败,而本文的目的,就是成功调试HelloWorld这个控制台应用程序. 通过我的寻找,其实是一个名为TryRun的文件出了 ...

  8. [原] KVM 虚拟化原理探究(6)— 块设备IO虚拟化

    KVM 虚拟化原理探究(6)- 块设备IO虚拟化 标签(空格分隔): KVM [toc] 块设备IO虚拟化简介 上一篇文章讲到了网络IO虚拟化,作为另外一个重要的虚拟化资源,块设备IO的虚拟化也是同样 ...

  9. The Zen of Python

    Beautiful is better than ugly. 优美总比丑陋好Explicit is better than implicit. 直率总比含蓄好Simple is better than ...

  10. webpack学习总结

    前言 在还未接触webpack,就有几个疑问: 1. webpack本质上是什么? 2. 跟异步模块加载有关系吗? 3. 可否生成多个文件,一定是一个? 4. 被引用的文件有其他异步加载模块怎么办? ...