开发者

mailing in android

I am working on andro开发者_JAVA技巧id platform. I want to send some data to a email address in android platform. Is there any class which can provide me facilities to send data . If there is a process to send data to any email address in android???


this is how you send an HTML email to someone:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"mame@example.com", "name2@example.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("my html text goes here"));
startActivity(intent);

to send an email with a PNG attachment, where pngDirectory is a File pointing to the images' location, and pngFileName is the file name of the file(myFile.png):

String pngLocation = "file://" + pngDirectory.getPath() + "/" + pngFileName;
startActivity(new Intent(Intent.ACTION_SEND)
            .setType("image/png")
            .putExtra(Intent.EXTRA_SUBJECT, "subject")
            .putExtra(Intent.EXTRA_STREAM, Uri.parse(pngLocation))
            .putExtra(Intent.EXTRA_TEXT, "blah")
        );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜