zoukankan      html  css  js  c++  java
  • 发送Email的简短代码

    public class EmailListener implements OnClickListener{

    @Override

    public void onClick(DialogInterface dialog, int which) {

    //新建一个E-mail 的Intent

    Intent EmailIntent = new Intent(Intent.ACTION_SEND);

    //设置E-mail标题

    String subject = "关于 aLibro";

    EmailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);

    //设置Email的内容

    String body = "关于 aLibro 的开发";

    EmailIntent.putExtra(Intent.EXTRA_TEXT, body);

    //设置要发送到的Email地址

    String[] Email_to = new String[]{"to1@example.com","to2@example.com"};

    EmailIntent.putExtra(Intent.EXTRA_EMAIL, Email_to);

    //设置抄送的Email地址

    String[] Email_cc = new String[]{"cc1@example.com","cc2@example.com"};

    EmailIntent.putExtra(Intent.EXTRA_CC, Email_cc);

    //设置密送的Email地址

    String[] Email_bcc = new String[]{"bcc1@example.com","bcc2@example.com"};

    EmailIntent.putExtra(Intent.EXTRA_BCC, Email_bcc);

    //如果是一般的Email,应该是纯文字的形态

    EmailIntent.setType("text/plain");

    //让用户自行决定要传送的E-mail客户端

    startActivity(Intent.createChooser(EmailIntent, "E-mail chooser"));

    }

    }

    权限设置:

    <uses-permission android:name="android.permission.SEND_SMS"/>

  • 相关阅读:
    区块链|学习笔记(三)
    左神算法之获取栈中最小值
    23种设计模式之适配器模式
    二叉树序列化和反序列化
    归并排序
    通过集合构建RDD或者DataFrame
    内核源码分析——shuffle
    问题
    函数参数
    问题记录
  • 原文地址:https://www.cnblogs.com/xingmeng/p/2456970.html
Copyright © 2011-2022 走看看