• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

issue: no application can perform this action , when send mail

 
Vijay Nimkarde
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a issue while sending the mail through android.
I am trying to send the mail at that time it shows no application can perform this action

see my code as belows :

public void sendEmail(Context context,String subject,String body)
{

final Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
String mailId="abc@gmail.com";
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL,new String[]{mailId});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT,body);

context.startActivity(Intent.createChooser(emailIntent, "Send Mail..."));
}

please reply me .
thanks in advanced .
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The intent type should be "message/rfc822".
 
Vijay Nimkarde
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ Ulf Dittmer
thanks for reply.
I have made this change but still the problem remains the same.
I have tested on device also. Not getting the solution.

can we send mails through Java Api . or any other ways that should work in android?
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay Nimkarde wrote:can we send mails through Java Api .


Yes we can use java mail API to send and retrieve mails.
It will work fine.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay Nimkarde wrote:I have tested on device also.

It won't work on the emulator unless you install an application that can handle email; by default no such app is installed. This should help: http://www.androidguys.com/2008/12/12/its-in-the-mail/

Hardik Trivedi wrote:Yes we can use java mail API to send and retrieve mails. It will work fine.

Not using standard JavaMail, it won't. An Android-compatible version is required: http://code.google.com/p/javamail-android/
 
Vijay Nimkarde
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ Ulf Dittmer , Hardik Trivedi

See now I used the following code

--------------------
public void sendEmail(Context context,String subject,String body)
{
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
String mailId="abc.gmail.com";
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{mailId});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,body);
try{
context.startActivity(Intent.createChooser(emailIntent, "Send Mail..."));
finish();
}catch (android.content.ActivityNotFoundException ex) {
Log.v("BBUtils", "Exception while sending email. "+ex);
}
}
-------------------
called text as

String mySubject="Testmail";
String myBodyText="This is simple test body";
sendEmail(ContactUs.this, mySubject, myBodyText);

and i will see the output as in attachments
in that i got the subject whatever i passed but I don't get the email Id Prepopulated as body to whom i am sending the mail.

See the Attachments
email through android.png
[Thumbnail for email through android.png]
email sending through android snap
 
Vijay Nimkarde
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Issue Resolved
I found some where on the Net
see the code

String mailId=(String)ContactUs.this.getString(R.string.contactus8);
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto",mailId, null));
//emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{mailId});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,body);
startActivity(emailIntent);


In this the mail id is getting prepopulated in to the To field .


Still thanks all that replies me
 
Prasildas Prabhadas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I was also in the same situation as of Vijay Nimkarde , even after trying the last solution as posted by Vijay Nimkarde I am getting the same error as before, I could't find any changes even after making those changes
 
Vm Gv
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasildas,

If you want to send an E-mail from your Emulator, you first need to configure your E-mail on the Emulator, that is, sign in to any of your mail accounts using the emulator, and then remain signed in.

Then, launch your application in the emulator, and the app will open up the E-mail compose window!

Cheers!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic