How to send email in Android ? [duplicate]

女生的网名这么多〃 提交于 2019-11-26 12:46:43

问题


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


回答1:


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"));



回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/3585556/how-to-send-email-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!