Rahul wrote:
> hi
> i am trying to send mail programatically by Using Android. i write
> following code by Using Intent but it shows Error "Noapplication can
> perform this action". plz tel me any Extra setting are required or wt
> is the problem
> My Code is
>
> protected void sendEmail() {
> // Setup the recipient in a String array
> String[] mailto = { emailTo.getText().toString() };
> //String[] ccto = { "[email protected]" };
> // Create a new Intent to send messages
> Intent sendIntent = new Intent(Intent.ACTION_SEND);
> // Add attributes to the intent
> sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
> //sendIntent.putExtra(Intent.EXTRA_CC, ccto);
> sendIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject.getText()
> .toString());
> sendIntent.putExtra(Intent.EXTRA_TEXT,
> emailBody.getText().toString
> ());
> // sendIntent.setType("message/rfc822");
> sendIntent.setType("text/plain");
> startActivity(Intent.createChooser(sendIntent, "MySendMail"));
> }
> }
First, switch back to message/rfc822.
That code should then work on an emulator set up with an application to
handle the delivery of emails. You may have to install one (e.g., K-9).
For this blog post:
http://androidguys.com/?p=3100
I tested right on a T-Mobile G1, and the code worked as described in the
post.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---