Android发送邮件(Send Email)

2020-09-14  本文已影响0人  zhujunhua

Andorid 调用其他app发送Email。

  1. Intent.ACTION_SENDTO
            // 1. 注意使用 Uri.encode()
            Uri uri = Uri.parse("mailto:" + email
                    + "?subject=" + Uri.encode(subject)
                    + "&body=" + Uri.encode(content));
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO, uri);
  1. Intent.ACTION_SEND, 有一些其他非email类的app也会弹出来
            Intent emailIntent = new Intent(Intent.ACTION_SEND);
            emailIntent.setType("text/html");
            emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{email});
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
            emailIntent.putExtra(Intent.EXTRA_TEXT, content);

参考:
stackoverflow

上一篇 下一篇

猜你喜欢

热点阅读