如何采用Android code发送电子邮件 [英] How to send the email using Android Code
本文介绍了如何采用Android code发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
<一href="http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-android-ap">Sending电子邮件在Android中使用JavaMail API不使用默认的Android应用程序(内建电子邮件应用程序)
我是新来的Android编码。我的要求是我想用Android的code发送电子邮件。
I am new to Android Coding. My Requirement is I want to send Email using Android Code.
请指导我关于这个。
推荐答案
下面是解决方案::
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
这篇关于如何采用Android code发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文