How can I send an email from android application directly without showing the default email form of the device?
I am building a form that sends emails from an android application, I am using Intents to send the email, that is:
Intent sendIntent;
sendIntent = new Intent(Intent.ACTION_SEND);
My requirement is that I want the email to be sent immediately, currently the application is showing me installed email applications in device where I can recompose the email before sending, I want to send the mail directly without showing installed applications.
Than开发者_Python百科ks
There are two ways
1) using SMTP follow the link for details
2) using Webservice( for example PHP script ) so there is a server side code and you hit that URL with param like ( name,subject etc) so basically PHP code send mail at the end and it's very easy to use .
Personally, I suggest you use Webservice
From what I have been able to find people suggest you write your own mini email app within your app. The following link is to a person who did just that:
http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_(no_Intents)_in_Android
Keep in mind to scroll through the bottom comments when you get stuck implementing certain parts. I hope that helps you from reinventing the wheel. :)
There are two solution
1) use JavaMail API
2) Implement SMTP to send mail without showing default.email application.
精彩评论