-5

I am developing an Application in android which include feature like sending emails. I am not getting how to start this.Did anyone tell me How email sending work in Android ? I mean what are the steps to send email via android application ?

Harish
  • 1

2 Answers2

1

this will send email via any installed mail client.

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"recipient@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject");
i.putExtra(Intent.EXTRA_TEXT   , "body");
try {
    startActivity(Intent.createChooser(i, "Send e-mail..."));
} catch (android.content.ActivityNotFoundException ex) {
    //you have no mail client
}
mihail
  • 2,173
  • 19
  • 31
0

you can send in any of the following way.

  1. Throw an email implicit intent. Then available email clients will send the email for you.

    for this you can check this famouse so thread

  2. If you want to create your own email client you can use JavaMail to send emails from your own application

Community
  • 1
  • 1
stinepike
  • 54,068
  • 14
  • 92
  • 112
  • lol, seems like i've been in the famous thread long time ago, my answer is a part of mine project :D – mihail Jun 03 '13 at 12:12