How can I send emails from my Android application? -
I am writing an application for Android. How can I send an e-mail from it?
The best (and easiest) way a intent
:
intent = new intent (int. Action_sand); I.setType ("Message / RFC822"); I.putExtra (Intent.EXTRA_EMAIL, new string [] {"recipient@example.com"}); I.putExtra (Intent.EXTRA_SUBJECT, "Email subject"); I.putExtra (Intent.EXTRA_TEXT, "Body of Email"); Try {startActivity (Intent.createChooser (i, "Send Mail ...")); } Hold (android.content.ActivityNotFoundException ex) {toast.makeText (MyActivity.this, "no email client is installed.", Toast .LENGTH_SHORT) .show (); }
Otherwise you will have to write your customer.
Comments
Post a Comment