I am trying to create a mail sending application in Android.
If I use:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
This will launch the built-in Android application; I'm trying to send the mail on button click directly without using this application.
For sending a mail with attachment..
Usage:
Configuration:
Permissions:
Also for attachments, you need to set READ_EXTERNAL_STORAGE permission:
Source
(I've tested it myself)
I found a shorter alternative for others who need help. The code is:
Source: Sending Email via JavaMail API
Hope this Helps! Good Luck!
You can use JavaMail API to handle your email tasks. JavaMail API is available in JavaEE package and its jar is available for download. Sadly it cannot be used directly in an Android application since it uses AWT components which are completely incompatible in Android.
You can find the Android port for JavaMail at the following location: http://code.google.com/p/javamail-android/
Add the jars to your application and use the SMTP method