@ 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
Joined: Jan 30, 2010
Posts: 252
posted
0
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
Marshal
Joined: Mar 22, 2005
Posts: 32768
posted
0
Vijay Nimkarde wrote:I have tested on device also.
--------------------
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.
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
Joined: Jan 31, 2011
Posts: 3
posted
0
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
Joined: Dec 13, 2011
Posts: 1
posted
0
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!!
subject: issue: no application can perform this action , when send mail