加入收藏 | 设为首页 | 会员中心 | 我要投稿 南通站长网 (https://www.0513zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

Android调用系统的发邮件技巧

发布时间:2021-11-25 21:27:10 所属栏目:教程 来源:互联网
导读://系统邮件系统的动作为Android.content.Intent.ACTION_SEND Intent email = new Intent(android.content.Intent.ACTION_SEND); email.setType(plain/text); emailReciver = new String[]{www.linuxidc.com@www.linuxidc.com.com, 1234567@www.linuxidc.com.c
//系统邮件系统的动作为Android.content.Intent.ACTION_SEND
Intent email = new Intent(android.content.Intent.ACTION_SEND);
email.setType("plain/text");
emailReciver = new String[]{"www.linuxidc.com@www.linuxidc.com.com", "1234567@www.linuxidc.com.com"};
emailSubject = "你有一条短信";
emailBody = sb.toString();
 
//设置邮件默认地址
email.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);
//设置邮件默认标题
email.putExtra(android.content.Intent.EXTRA_SUBJECT, emailSubject);
//设置要默认发送的内容
email.putExtra(android.content.Intent.EXTRA_TEXT, emailBody);
//调用系统的邮件系统
startActivity(Intent.createChooser(email, "请选择邮件发送软件"));
 
带附件:
 
 
Intent returnIt = new Intent(Intent.ACTION_SEND);
 
       String[] tos = { "admin@www.linuxidc.com" }; //send to someone
 
       String[] ccs = { "root@www.linuxidc.com" };  //Carbon Copy to someone
 
       returnIt.putExtra(Intent.EXTRA_EMAIL, tos);
 
       returnIt.putExtra(Intent.EXTRA_CC, ccs);
 
       returnIt.putExtra(Intent.EXTRA_TEXT, "body");
 
       returnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
 
Uri uri = Uri.parse("file:///sdcard/mysong.mp3");
 
returnIt.putExtra(Intent.EXTRA_STREAM, uri);
 
returnIt.setType("audio/mp3");  //use this format no matter what your attachment type is
 
returnIt.setType("message/rfc882");
 
Intent.createChooser(returnIt, "Choose Email Client");
 
startActivity(returnIt);

(编辑:南通站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读