我想從我的應用程序發送電子郵件,而無需在Android設備中配置電子郵件。 我們可以這樣做嗎??我們點擊一個按鈕,郵件將自動發送給收件人。通過Android應用程序發送電子郵件
我已經使用了下面的代碼。我們可以在哪裏給發件人姓名。 ,我們可以通過android模擬器發送郵件。
Thanx。
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL , new String[]{"[email protected]"});
intent.putExtra(Intent.EXTRA_SUBJECT, "Request For Quote");
intent.putExtra(Intent.EXTRA_TEXT , "Hi....");
try {
//startActivity(Intent.createChooser(intent, "Send mail..."));
startActivity(intent);
//Toast.makeText(SendingEmailActivity.this, "Mail Sent Successfully", Toast.LENGTH_SHORT).show();
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(DemoActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
非常感謝你。這個鏈接真的幫助我。 – Himanshu 2011-05-27 10:13:35