直接贴代码:

  1. Intent intent = new Intent(android.content.Intent.ACTION_SEND);
  2. // 附件
  3. File file = new File(Environment.getExternalStorageDirectory().getPath()+ File.separator + "simplenote"+ File.separator+"note.xml");
  4. // 收件人
  5. intent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] {"pop1030123@163.com"});
  6. // 主题
  7. intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "note.xml");
  8. // 正文
  9. intent.putExtra(android.content.Intent.EXTRA_TEXT,"this is test extra.");
  10. intent.setType("application/octet-stream");
  11. //当无法确认发送类型的时候使用如下语句
  12. //intent.setType(“*/*”);
  13. //当没有附件,纯文本发送时使用如下语句
  14. //intent.setType(“plain/text”);
  15. intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
  16. NoteActivity.mNext_tab = NoteActivity.NOTE_SETTING;
  17. startActivity(Intent.createChooser(intent, "Mail Chooser"));

另外的参考代码:

  1. //系统邮件系统的动作为android.content.Intent.ACTION_SEND
  2. Intent email = new Intent(android.content.Intent.ACTION_SEND);
  3. email.setType("text/plain");
  4. emailReciver = new String[]{"pop1030123@163.com", "fulon@163.com"};
  5. emailSubject = "你有一条短信";
  6. emailBody = sb.toString();
  7. //设置邮件默认地址
  8. email.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);
  9. //设置邮件默认标题
  10. email.putExtra(android.content.Intent.EXTRA_SUBJECT, emailSubject);
  11. //设置要默认发送的内容
  12. email.putExtra(android.content.Intent.EXTRA_TEXT, emailBody);
  13. //调用系统的邮件系统
  14. startActivity(Intent.createChooser(email, "请选择邮件发送软件"));

android调用邮件应用发送email的更多相关文章

  1. 廖雪峰Java13网络编程-2Email编程-1发送email

    1.邮件发送 1.1传统邮件发送: 传统的邮件是通过邮局投递,从一个邮局到另一个邮局,最终到达用户的邮箱. 1.2电子邮件发送: 与传统邮件类似,它是从用户电脑的邮件软件(如outlook)发送到邮件 ...

  2. android中调用系统的发送短信、发送邮件、打电话功能

    1 调用发送短信功能: Uri smsToUri = Uri.parse("smsto:");  Intent sendIntent = new Intent(Intent.ACT ...

  3. python 发送email邮件带附件

    EMAIL功能实现: 1.发送EMAIL带附件,并且带压缩文件夹做为附件 #_*_coding:utf-8_*_ import smtplib from email.mime.text import ...

  4. C#发送Email邮件(实例:QQ邮箱和Gmail邮箱)

    下面用到的邮件账号和密码都不是真实的,需要测试就换成自己的邮件账号. 需要引用: using System.Net.Mail; using System.Text; using System.Net; ...

  5. [转]C#发送Email邮件 (实例:QQ邮箱和Gmail邮箱)

    下面用到的邮件账号和密码都不是真实的,需要测试就换成自己的邮件账号. 需要引用:using System.Net.Mail;using System.Text;using System.Net; 程序 ...

  6. 使用spring 并加载模板发送Email 发邮件 java 模板

    以下例子是使用spring发送email,然后加载到固定的模板,挺好的,大家可以试试 需要使用到spring-context 包 和 com.springsource.org.apache.veloc ...

  7. 【转】C#发送Email邮件

    转自:http://hi.baidu.com/bluesky_cn/item/8bb060ace834c53f020a4df2 下面用到的邮件账号和密码都不是真实的,需要测试就换成自己的邮件账号. 需 ...

  8. .net 邮件批量发送功能源码

    #define debug   using System; using System.Text; using System.Linq; using System.IO; using System.Ne ...

  9. asp.net发送E-mail

    发送电子邮件也是项目开发当中经常用到的功能,这里我整理了一个发送电子邮件(带附件,支持多用户发送,主送.抄送)的类库,供大家参考. 先上两个实体类,用于封装成Mail对象. /// <summa ...

随机推荐

  1. nuxt 头部引入js文件 第一次进入页面不加载js文件的解决方法

    head () { return { title: '', meta: [ { hid: 'description', name: 'description', content: '' } ], sc ...

  2. Java poi 的使用

    poi可操作老旧版本的excel 下载jar包,http://archive.apache.org/dist/poi/release/bin/poi-bin-3.17-20170915.tar.gz ...

  3. robotframework接口测试实例

    *** Settings *** Library Collections Library RequestsLibrary *** Test Cases *** test Create Session ...

  4. QT +自定义控件-spin+slider

    动手实现自定义控件: 1.首先在ui界面中添加一个(Widget)容器类.如图中的1所示 2.在项目中添加一个SmallWidget类,如下: 3.接着在程序编辑界面进行程序编辑如下: #includ ...

  5. gitlab autuo devops

    [参考文章] Chengzi_comm的专栏 use gitlab ci docker run gitlab-runner gitlab-runner register 1. 在虚拟机或服务器运行gi ...

  6. PWN题搭建

    0x00.准备题目 例如:level.c #include <stdio.h> #include <unistd.h> int main(){ char buffer[0x10 ...

  7. Ibatis入门基本语法

    1.       Ibatis是开源软件组织Apache推出的一种轻量级的对象关系映射(ORM)框架,和Hibernate.Toplink等在java编程的对象持久化方面深受开发人员欢迎. 对象关系映 ...

  8. mysqldump导出备份数据库报Table ‘performance_schema.session_variables‘ doesn‘t exist

    今天在bash进行本地数据库往云端数据库导数据的时候,在本地导出.sql文件这第一步就出现了错误问题,导出sql文件的命令: mysqldump -u 用户名 -p 数据库名 > xxx.sql ...

  9. axure笔记--内置变量

    部件变量: This:当前变量名称 Target:目标变量的名称 x,y表示组件左上角的位置 name:获取当前组件标签命名 Top:获取组件上边界到x轴的距离 bottom:获取组件下边界到x轴的距 ...

  10. Python Cookbook3 Python进阶教程 http://python3-cookbook.readthedocs.io/zh_CN/latest/copyright.html

    http://python3-cookbook.readthedocs.io/zh_CN/latest/copyright.html