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"/>

  • 相关阅读:
    javascript题目,如何在重写alert后还能正常弹出alert
    mass Framework support模块 v2
    javascript suggest效果
    HTML <div> 标签的 align 属性
    SQL GROUP BY 语句
    SQL UPDATE 语句
    HTML <font> 标签
    JavaScript eval() 函数
    HTML DOM Checkbox 对象
    CSS cursor 属性
  • 原文地址:https://www.cnblogs.com/xingmeng/p/2456970.html
Copyright © 2011-2022 走看看