1
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(StaffHome.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
我嘗試用此發送郵件。 但彈出消息顯示「沒有應用程序可以執行此任務」如何在android工作室發送電子郵件
你有在設備上的電子郵件應用程序? –
您正在設備或模擬器中運行應用程序? –
試試這個i.setType(「plain/text」); – KishuDroid