Android Email App Using Javamail API in Android Studio

In this post we will create an Android Email App. We will not use the default Android Email Client to send emails instead we will use Javamail API to create our own email sender. And you can …

android email app

In this post we will create an Android Email App.

We will not use the default Android Email Client to send emails instead we will use Javamail API to create our own email sender. And you can also use this App for Email.

So if you are searching Best Email App for Android then try the app created by yourself 😉

Before going through the tutorial you can check the following video to see exactly what you will be creating in this tutorial.

Android Email App – Video

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

[download id=”1481″]

  • 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.

Get source code of Android Email App

[sociallocker id=1372] [download id=”1500″] [/sociallocker]

So thats all for this Android Email App tutorial. Leave your comments if you are having any queries or trouble for this Android Email App. Thank You 🙂

Hi, my name is Belal Khan and I am a Google Developers Expert (GDE) for Android. The passion of teaching made me create this blog. If you are an Android Developer, or you are learning about Android Development, then I can help you a lot with Simplified Coding.

Expand Your Knowledge: Next Tutorial Picks

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x