2011-05-27 106 views
0

我想從我的應用程序發送電子郵件,而無需在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(); 
       } 

回答

0

沒有任何干預,你不能使用Intents。

看看This tutorial有關的JavaMail和Android

相關問題