zoukankan      html  css  js  c++  java
  • 手机交互应用服务(邮件)

    1.纯文本发送:

      使用这种方式会调用其他的邮件发送程序,相当于点击了系统的邮件App或其他的邮件客户端(qq、Gmail、网易等)

    public void sendEmail(String title, String content) {
        Intent email = new Intent(Intent.ACTION_SENDTO);
        email.setData(Uri.parse("mailto:happyhaoye@gmail.com"));
        email.putExtra(Intent.EXTRA_SUBJECT, title);
        email.putExtra(Intent.EXTRA_TEXT, content);
        startActivity(Intent.createChooser(email, "请选择邮件发送程序!"));
    }

    2.带附件的发送:

      public void sendEmailWithAttachment(String title, String content, File attachment) {
            Intent   email      = new Intent(Intent.ACTION_SEND);
            String[] emailAddrs = new String[]{"happyhaoye@gmail.com","hehehehe@163.com"};
            
            email.setType("application/octet-stream");//---设置邮件类型:带附件
                    
            email.putExtra(Intent.EXTRA_EMAIL, emailAddrs);
            email.putExtra(Intent.EXTRA_SUBJECT, title);
            email.putExtra(Intent.EXTRA_TEXT, content);
            email.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachment));
            
            startActivity(Intent.createChooser(email, "请选择邮件发送程序!"));
        }
  • 相关阅读:
    spingboot集成jpa(二)
    datanode与namenode的通信
    Yarn NodeManager restart
    hadoop上线和下线节点
    Spark读取文件
    eclipse安装中文补丁包
    eclipse中maven打包
    (转) eclipse安装lombok
    Windows 访问 Oracle
    wCF 问题收集页
  • 原文地址:https://www.cnblogs.com/laishenghao/p/5243254.html
Copyright © 2011-2022 走看看