i have to sent image via my application in mail body.
but i am unable to see that image in mail editor. it only shows rectangular box with written "OBJ" inside.
thanx.
I am using the following code.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"Product:"+ProductComparisonActivity.s_title);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Title:
"+ProductComparisonActivity.s_title+"\n"+"Description:
"+ProductComparisonActivity.s_des+"\n"+"\n"+"Max Price:
"+ProductComparisonActivity.s_max+"\n"+"Min Price:
"+ProductComparisonActivity.s_min+"\n");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("<img src="+"\""+ProductComparisonActivity.image_med+";base64,#IMAGEDATA#"+"\">",imgGetter,null));
// emailIntent.putExtra(Intent.EXTRA_STREAM, ProductComparisonActivity.prod_bmp);
emailIntent.setType("text/html");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
Sorry, I don't think it is possible.
Related
I'm currently trying to create an app that will take a picture and then attach that picture to an email and send the email.
what i m trying to say
step
1. add recipient Email Address.
2. add Subject.
3. add Some Text.
and Last And Main
4. Attach image from camera and sent that Mail.
I want to send mail from my own application only?? without using any inbuilt Gmail app?
Try below code
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("application/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{strEmail});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "From My App");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg"));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
UPDATE
Try this link, it will help you
hi iam developing an android app in it we can take photo and send it to default email i implement capturing of image with MeadiaStore.ACTION_IMAGE_CAPTURE);
and i get location by using location.getLatitude() , location.getLongitude();
then how to attach this image and location to email like subject as email.putExtra(Intent.EXTRA_SUBJECT,"subject");
First you have to store the captured image in sdcard and the Use this code to send email
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("application/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{strEmail});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "From App");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg"));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
I tried following code
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
shareEmailSubject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
Html.fromHtml("<b>text to be shared</b><br>link");
but when I send the email, no styles are appearing while
1. sending the email
2. After email is received on desktop email client(eg. gmail)
i tried your code and it is working fine at my end
String body = "<b>text to be shared</b><br>link";
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "hi");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
Html.fromHtml(body));
startActivity(Intent.createChooser(emailIntent, "Email:"));
The problem which I was facing was due to default android mail client, when I switched to share via gmail, it worked perfectly fine.
We can open share dialog using ACTION_SEND to share text
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Download Link: Android play store link");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share This App"));
How can I use ACTION_SEND to share a text file.
I read http://developer.android.com/training/sharing/send.html but could not get how to share text file.
Use the following line.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("*/*");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"me#gmail.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
"go on read the emails");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromfile(new File(yourtextfilepath));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
Make sure that your text file path should be from external memory card. Action send wont accept the files from internal memory.
Hope this will help you.
I Have sharing image problem with the Gmail Application.
This is my code.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.mail_subject));
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.mail_body));
emailIntent.putExtra(Intent.EXTRA_TITLE, getString(R.string.facebook_share_text));
//Download the image first
String location=downloadImage(true);
File root=android.os.Environment.getExternalStorageDirectory();
Log.e("send from where:","file:///"+root.getAbsolutePath()+"/"+location);
//Add attachment
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+root.getAbsolutePath()+"/"+location));
emailIntent.setType("image/jpeg");
startActivity(Intent.createChooser(emailIntent, getString(R.string.share_by)));
Default email app is Working great, Facebook Share is working great, Gmail App seams to work but the attachment is not send, although is displayed as attachment.
Here are the screen shots.
So please help.
String location=downloadImage(true);
File root=android.os.Environment.getExternalStorageDirectory();
Log.e("send from where:","file:///"+root.getAbsolutePath()+"/"+location);
//Add attachment
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+
root.getAbsolutePath()+"/"+location));
// replace "Uri.parse" with Uri.fromFile(new File("file:///"+
root.getAbsolutePath()+"/"+location))
emailIntent.setType("image/jpeg");
startActivity(Intent.createChooser(emailIntent, getString(R.string.share_by)));
This thing actually worked for me. Same thing occurs to me, when I sent the Uri.parse. You can see that the size of the attachment will show 0 kb. But when I change it, it worked just fine.
Share image working on facebook,whatsapp,gmail,bluetooth and messages also
Uri imageUri = Uri.fromFile(file);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM,imageUri);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent,"Share with.."));