开发者

How to send email in Android ? [duplicate]

This question already has answers here: 开发者_如何学Go How to send emails from my Android application? (25 answers) Closed 7 years ago.

How does one send a simple email message, in code, on Android?


Intent sendIntent;

sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Test Subject");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Test Text");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + fileName));
sendIntent.setType("image/jpeg");

startActivity(Intent.createChooser(sendIntent, "Send Mail"));


Check out the code at anddev.org for how to do it using intents.


If you don't want to use the User interface for sending mails, check this link: Sending Email in Android using JavaMail API without using the default/built-in app

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜