【Android基础】调用系统发Email和短信

调用系统发短信的代码:

 

Uri smsToUri = Uri.parse("smsto:");// 联系人地址 Intent mIntent = new Inten(android.content.Intent.ACTION_SENDTO,smsToUri); mIntent.putExtra("sms_body", "www.baidu.com");// 短信的内容 startActivity(mIntent);

 

调用系统发Email的代码:

 

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); //设置文本格式 emailIntent.setType("text/plain"); //设置对方邮件地址 emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, ""); //设置标题内容 emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,getString(R.string.setting_recommend_words)); //设置邮件文本内容 emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,getString(R.string.setting_recommend_words)); startActivity(Intent.createChooser(emailIntent,"Choose Email Client"));

你可能感兴趣的:(android,email,sms)