Sending email with attachment using intent.

Quickly share your Android Code Snippets here...

Sending email with attachment using intent.

Postby Jhon » Wed Feb 10, 2010 7:16 am

Intent sendIntent = new Intent(Intent.ACTION_SEND);
// Add attributes to the intent
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendIntent.putExtra(Intent.EXTRA_SUBJECT,"subject line");
sendIntent.putExtra(Intent.EXTRA_TEXT,"Body of email");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("Filename")));
sendIntent.setType("vnd.android.cursor.dir/email");

startActivity(Intent.createChooser(sendIntent,"Email:"));


By using above code we send the emails with attachments..
Happy Journey
Jhon
Jhon
Freshman
Freshman
 
Posts: 9
Joined: Wed Sep 09, 2009 4:06 pm

Top

Re: Sending email with attachment using intent.

Postby NAthani3l » Mon Jan 24, 2011 6:59 am

Are these codes used in sending email with attachment using the internet? It is difficult to understand how to use it. Maybe you can add more information about the procedures.
NAthani3l
Freshman
Freshman
 
Posts: 2
Joined: Mon Jan 24, 2011 6:46 am

Re: Sending email with attachment using intent.

Postby strider2023 » Wed Feb 23, 2011 12:22 pm

Hey this solution does not use intent but I think this might help. Developed an app by using this method and it works liked charm...please feel free to ask me if you face any problems. =)

http://www.jondev.net/articles/Sending_ ... in_Android
strider2023
Senior Developer
Senior Developer
 
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 2 guests