开发者

Hidden/Background Email Send in Android

how can i send email from my android application.please guide me a little bit i used the code

 final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
         emailIntent.setType("plain/text");
         emailIntent.putExtra(android.content.Inte开发者_如何学Cnt.EXTRA_EMAIL, "email@abc.com");
         emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
         emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Email-Content");
    SpeedAlert.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

but this is giving me Error: "No Application can Perform this Action"

How can i send email from my application Please guide. actually i want my application to send the email hiddenly. with Fix Body-Content and Subject

Thanks Waiting for some positive Response.


You're likely getting the "No Application can Perform this Action" in the emulator because there is not application installed that can handle the intent. So you can either install an email/gmail apk, or try it on an actual phone.

As far as sending email in the background (hidden) you will have to implement an SMTP client in your app to do that. Another approach would be to post the relevant information to a web-based service that sends the mail for you.

By using the intent mechanism, you are handing control over to another app to send the email, and there is no way to hide it from the user.

However, I would question whether it's a good idea to have your app sending emails without your users knowing about it, unless it is in response to a user action and they know what's going on.


I had the same problem in the emulator and I solved it by configuring EMail application. After I did all the config thing, I could easily send an email.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜