0

I am currently creating an alternate email app as a fun side-project for myself and I'm stuck at finding out how exactly I implement the ability to send emails... I presume an API would be required, but how exactly could I reference that API in my code/install it? I need to make something that can take a user's input from a textbox in which they enter the receiver's email address, then take the input from another text box (which will be for inputting the message) and then it will send it from an already registered email account. (P.S. I'm using Android Studio)

  • possible duplicate of [Send Email Programmatically in Android](http://stackoverflow.com/questions/7274949/send-email-programmatically-in-android) – scottt Mar 26 '14 at 03:20

1 Answers1

0

In Android, you can make use of Intent (to be precise Intent.ACTION_SEND) to send an email using an already registered email account

    Intent email = new Intent(Intent.ACTION_SEND);
    email.putExtra(Intent.EXTRA_EMAIL, new String[]{"youremail@yahoo.com"});          
    email.putExtra(Intent.EXTRA_SUBJECT, "subject");
    email.putExtra(Intent.EXTRA_TEXT, "message");
    email.setType("message/rfc822");
    startActivity(Intent.createChooser(email, "Choose an Email client :"));

You can also refer to http://javatechig.com/android/how-to-send-email-in-android as well as http://www.tutorialspoint.com/android/android_sending_email.htm for details.

Balwinder Singh
  • 2,272
  • 5
  • 23
  • 34