Things You Need To Have Before Writing This Mail Code

1) Use Android Studio or Eclipse.
2) Download and add the Following JAR files into your project.
3) Also you need to enable less secure accounts on google from here Enable Account
NOTE: This account would be the account which is going to be used in your App to send email from.

i) MAIl.JAR
ii) ACTIVATION.JAR
iii) ADDITIONAL.JAR


After including these jar files in your project you need to open your gradle module App and add in the dependencies following


build.gradle (Module App)


Now, Open your AndroidManifest.xml file and add the following internet permissions after < /application> tag


AndroidManifest.xml


Now, Open your activity_main.xml file and paste the following code.


activity_main.xml


Now Open your MainActivity.java file and add the following code


MainActivity.java


Now make a java class in your project and name it as GmailSender.java


GmailSender.java


Make another java class in your project and name it as JSSEProvider.java


JSSEProvider.java