Download Javamail API for Android

  • For this Android Email App we will use Javamail API, so before starting our android project download Javamail API from link given below

Javamail API Download (9386 downloads)

  • You will get a zip file from the above link. Extract the zip and you will get three .jar files. We will use these .jar files in our android email app project.

Creating Android Email App in Android Studio

  • Open Android Studio and create a new android project.
  • First we will add the downloaded .jar’s to our project.
  • From the left panel click on Android -> Project (see the image below)

android

android

  • Now you will get the libs folder inside projectfolder -> app -> libs . Paste all the three .jar files which you have downloaded above inside the libs folder. (See the image below)

javamail api

javamail api

  • Now go to file -> project structure.

project structure

project structure

  • Now go to dependencies and from the right click on the green + sign and then click on file dependencies.

file dependencies

file dependencies

  • Now go to libs folder and add all the three .jar files (you can see in the image)

adding jar android studio

adding jar android studio

  • Now click on ok, ok and you have added the apis to your project.
  • Now come to activity_main.xml and create the following layout.

android email app

android email app

  • Use the following code for creating the above layout.
  • For this android email app we will use gmail to send emails. So create a new java class named Config.java and write the following code.
  • You have to write your gmail username and password.
  • Now create a new class SendMail.java. It will send our email. Write the following code in this class.
  • Now come to MainActivity.java and write the following code.
  • Finally add internet permission to manifest.
  • Thats it now run your application.

android email app

android email app

  • Bingo! It is working absolutely fine. You can also download the source code of my project from below.

 

 

 

Source :https://www.simplifiedcoding.net

chandan

""

Androidandroid,android studio,code,email,script
Download Javamail API for Android For this Android Email App we will use Javamail API, so before starting our android project download Javamail API from link given below Javamail API Download (9386 downloads) You will get a zip file from the above link. Extract the zip and you will get three .jar files. We...