用 Android Intent 發郵件

weixin_34413357發表於2015-04-23

三句話小結

  1. Intent.ACTION_SENDTO 多在發純文字郵件時用
  2. Intent.ACTION_SEND 郵件附件可帶可不帶
  3. Intent.ACTION_SEND_MULTIPLE 傳送多附件時用

參考文件

Intent
Android 之呼叫系統 Email 傳送郵件

程式碼看上去是這個樣子

Intent email = new Intent(Intent.ACTION_SEND);
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_EMAIL, new String[] {"info@skillgun.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "Hi, This is a test mail..");  
email.putExtra(Intent.EXTRA_TEXT   , "Did you get this mail? if so please reply back");
startActivity(Intent.createChooser(email, "Choose an Email Client"));

相關文章