我看着它,這是發送電子郵件的最常用方法...如何使一個按鈕提交多個文本到我的電子郵件?
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"[email protected]"});
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();
}
我很困惑,這是什麼實際發送,以及如何當用戶點擊一個這種情況發生按鈕。我是否將收件人電子郵件(我)這樣?
i.putExtra(Intent.EXTRA_EMAIL , "[email protected]");
那麼對於郵件的主題和郵件/正文的格式是什麼?
這是我如何把用戶的輸入到電子郵件的正文? (用戶輸入多個editText框)
editText userTitle = (editText)findViewById(R.id.idOfTheEditTextBox);
editText userDescription = (editText)findViewById(R.id.idOfTheEditTextBox);
然後像這樣輸入嗎?
i.putExtra(Intent.EXTRA_TEXT , "userTitle", "userDescription");
最後,所有的烤麪包和沒有安裝電子郵件客戶端的意思是什麼?我是Android應用程序開發新手,並且正在Android Studio上製作應用程序!所有幫助非常感謝!謝謝!
請參閱此鏈接https://developer.android.com/guide/components/intents-common.html#ComposeEmail –
**沒有電子郵件客戶端安裝**意味着沒有電子郵件應用程序安裝在設備上像Gmail或其他。 – skydroid