Android email html attachment

Send Email with Attachment in Android

Posted by: Manish Srivastava in Android Core October 3rd, 2013 20 Comments Views

This is a simple demo for send email in Android with attachment. For attachment I am using Intent.ACTION_GET_CONTENT.

Don’t forget to add permissions in your manifest.xml-

1)MainActivity.java

2)activity_main.xml

3)AndroidManifest.xml

Like This Article? Read More From Java Code Geeks

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Thanks for the above tutorial,

But How can we read email with Attachments in Android App.

As we can read Complete Mail on Gmail’s Own App.

Thanks A lot again.

Waiting for Your Reply.

i’m new for android…. i need code for displaying DAT file……

i have one problem..

i added this to my app but i can’t make it work

i made new activity and added this to AndroidManifest

also i did the other but not working… it’s workin when i make contactusActivity the default activity… how i can run it along with the other activities?

Hello, how can we do the same thing but this time for a word document ??

How can i send an email in background in android studio?

I am getting errors with this code 🙁

in above code only image can attached how we do for any doc file or other file

Sir! The code almost works fine… But, whenever i send email or compose it.. It shows me “Successfully! sent”… (I had added a alert) but the message doesn’t actually sent.. I had checked mailbox and even Spambox but no message there sent via this app.

Please feedback this query with a valid solution.

Источник

Android Hub 4 you : the free android programming tutorial

Pages

Sunday, September 22, 2013

Send Email with Attachment in Android | Code for send email in Android | Sample demo for sending email in android with attachment

This is a simple demo for send email in Android with attachment. For attachment I am using Intent.ACTION_GET_CONTENT.
Don’t forget to add permissions in your manifest.xml-

Читайте также:  Android device configuration service data

60 comments:

HI manish have checked with working device the code was not performing any operations on it.

It should work dear! I have tested it on many devices. Something wrong I think. Please check permission, package name.

image is not uploading

Hi manish in this application give me error » No application can perform this action». how to solve it.

You are using emulator for testing? If you are using device please use some application for send email first like yahoo, gmail etc. You can sync a gmail account with your mobile or emulator.

how to set up internet on the emulator?

Hi manish. i got an error in mainactivity.java. «activity_main cannot be resolved or is not a field». how to solf it?

I think in your project R.java file is not created. please clean and re-build your project.

Hello manish, this s working . this application want to test in device . great work manish

hiii manishb great work. Can I send My sqlite data using it should display in table format in email

You can’t send it directly from sqite. You need to generate report first in pdf or any other format after that you can send as attachment.

Thank you manish..If I dont want use Third Party Api then there is any solution without using any Api can we save data in Html..if you have source code of how generate report in Android then please suggest

Sorry dear no idea. Well if you want do that you can use web-service to send your data on server and from there do what you want.

sry, i have a question 🙁 it not run with my adt, can you send project to me dinhthehoa.aks@gmail.com i ready need it for big my homework. Please. Thank you

Читайте также:  Мобильная версия андроид для компьютера

Okay I am sending zip code please try to import into your workspace.

Hey email is going successfully but without an attachment.
can you tell why is this happening?

please check your log-cat is there path of image or not? may be your path==null.

This absolutely works. Thanks alot

hi manish
i am new to this android coding
i was trying for something else and i got this code i tried it, it is working fine but when i click on attachment it is directing me to gallery and if i click on any image it is not picking up the file plz help me
thank you very much.

how to send image file as attachment from my project assets folder its very urgent can someone please help me

Sir, i want the zip file.
i am new in android and unable to run this program perfectly . so, I need your help
my email id : rshrwan@gmail.com

Please copy paste from above it is very simple program. It should work properly. Actually I don’t have this code on GIT server.

How to add the images into emulator gallery?can you please let me know th esolution?

Use DDMS in eclipse. Using DDMS you can put an image into your sdcard.

I always that I select a archive, Always get a error nullpointer : NOT WORK correctly al least > 4.0

As it shows nullpointer exception its mean your data is null when you trying to get onActivityResult.
So use try catch here. And use any other method to get the url of image.

public void openGallery() <
Intent intent=new Intent(Intent.ACTION_PICK);
intent.setType(«image/*»);
startActivityForResult(intent, GALARY_REGUEST);

>
protected void onActivityResult(int requestCode, int resultCode, Intent data) <
super.onActivityResult(requestCode, resultCode, data);
URI=data.getData();
>

Hii manish i want to add my pdf files into attachment. It can be possible to add pls help me .
thnx for before posts..

Yes sure you can send any type of file. Just pass your URI of your PDF file.
And for user Interface you need to implement chooser lib like yahoo mail app using.

Читайте также:  Tv dongle and android tv

Hi Manish my name is Arslanali. It is necessary to send a xml file by email. I do not understand how to send a file. You can not find an example of sending a file?
Thanks Manish

This comment has been removed by the author.

Hii manish i want to add my pdf files into attachment. It can be possible to adding attachment pls help me .
thnx for before posts..

Yes sure you can send any type of file. Just pass your URI of image.
And for user Interface you need to implement chooser lib like yahoo mail app using.

Hi manish, actually i’m in trouble with my small project, wil you help me with pick / send image to a mail id,(where i have camera interface from where i capture image and captured image should be sent to a particular (fixed) mail id ).. i’m new to android so facing lot of problems hope you eil help..

What if we want to pick image and send by one button only? This is you attach first and send. It should send immediately after attached. Any tutorial? Thank you.

hi manish, please help i just want the form to send the mail to a pre defined email

So just pass your email id here-
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] < xyz@gmail.com>);

Hello Sir, Thnxx a lot.. after making some change, this project i.e. working superb. thank you so so much for such type article.. I really appreciate your effort and salute to you.. Please teach us hoe to capture image and send it to send to ListView as well as choose pic from gallery. thnxx a lot fro such type article again.

To display image in listview first you need to store images into local storage or sqlite or any collection. Kindly follow below below url, it will help you using sqlite database to display image in listview.

Источник

Оцените статью