Send Email in Android using the default android app(Builtin Email application)

I want to send email from my application using the default android email app. I have written a code for that as

Intent mailIntent = new Intent(android.content.Intent.ACTION_SEND);
mailIntent.setType("plain/text");
mailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { EMAIL });
mailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Invitation");
mailIntent.putExtra(android.content.Intent.EXTRA_TEXT,MAIL_MESSAGE);
startActivity(mailIntent);

But here it is opening the email application. I want to send the mail instead of starting any activity. Is there any ways to replace the startActivity and initiate the intent action?

Please help me.

Thanks in advance.


this link can be useful, have a look at another useful link or a code snippet from this link is attached below

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);  

emailIntent.setType("plain/text");  
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, newString[]{"yourmail@website.com"});  
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mySubject);  

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, myBodyText);  

startActivity(Intent.createChooser(emailIntent, "Send mail));  

Hope that helps...


yes you can done it by configuring the mail code on server side and from android call web service then server will send the mail

http://fahmirahman.wordpress.com/2011/04/21/connection-between-php-server-and-android-client-using-http-and-json/

链接地址: http://www.djcxy.com/p/23260.html

上一篇: 当另一个意图完成时开始一个意图

下一篇: 使用默认的Android应用程序(Builtin Email应用程序)在Android中发送电子邮件