I am working on sending my message data on my email Id.I have made a mainActivity class containing an editText (for emailId) and a Button. Another class is BroadcastReceiver class in which I retrieve data. Now I can't understand how to send that data to the provided email in Background. I have googled a lot but can't get the required response. Please share the ideas and help me in it.
I create open source library for this. Usage is very simple:
BackgroundMail bm = new BackgroundMail(context);
bm.setGmailUserName("[email protected]");
bm.setGmailPassword("yourgmailpassword");
bm.setMailTo("[email protected]");
bm.setFormSubject("Subject");
bm.setFormBody("Body");
bm.send();
With this permissions
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
You can download it here: https://github.com/kristijandraca/BackgroundMailLibrary
In android, You can send Email with explicit email intent however it will show a email screen and will not allow to send data in background.
To send data in background, you can use java mail api to send the mail.
Take a look on this http://www.tutorialspoint.com/java/java_sending_email.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With