res/layout/main.xml如下
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://www.easck.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<Button
android:id="@+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/reciver"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/cc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/subject"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/body"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
上面是android中实现发送邮件功能的方法之一,还有另外两种方法如下所示:
方法一:
Uri uri=Uri.parse("mailTo:1650***185@qq.com");
Intent i=new Intent(Intent.ACTION_SENDTO,uri);
startActivity(i);
方法二:
Intent i=new Intent(Intent.ACTION_SEND);
String[] tos={"1650***185@qq.com"};
String[] ccs={"7885***158@qq.com"};
i.putExtra(Intent.EXTRA_EMALL,tos);
i.putExtra(Intent.EXTRA_CC,ccs);
i.putExtra(Intent.EXTRA_TEXT,"邮件内容");
i.putExtra(Intent.EXTRA_SUBJECT,"邮件主题");
i.setType("message/rfc822");
startActivity(Intent.createChooser(i,"你的邮件"));










