Email, Send, Intent, IntentChooser

Quickly share your Android Code Snippets here...

Re: Email, Send, Intent, IntentChooser

Postby Dmitry.Skiba » Thu May 28, 2009 5:13 pm

plusminus wrote:Short snippet to start an Email-Activity with some preset data:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
  2. emailIntent .setType("plain/text");
  3. emailIntent .putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"webmaster@website.com"});
  4. emailIntent .putExtra(android.content.Intent.EXTRA_SUBJECT, mySubject);
  5. emailIntent .putExtra(android.content.Intent.EXTRA_TEXT, myBodyText);
  6. context.startActivity(Intent.createChooser(intent, "Send mail...));
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Wasted 30 minutes before I realised that type should be text/plain! Same for text/html. Please fix original message.
Dmitry.Skiba
Developer
Developer
 
Posts: 33
Joined: Thu Aug 28, 2008 12:52 pm

Top

IM Intent

Postby bhushan.kasturiwale » Tue Jun 02, 2009 7:48 am

Hello SlumberMachine,

Can you please give the code snippet for launching the IM.
I have the g talk set up done on my Android Phone.
I want the intent and intent filter.
Also can u plz give me the proper type for it.

Thanks!
Bhushan
bhushan.kasturiwale
Freshman
Freshman
 
Posts: 4
Joined: Mon May 25, 2009 12:35 pm

Postby desuvinodkumar » Tue Jul 28, 2009 10:49 am

HI
Is there any intent to get notify when we get new email.....recieved to show this message like emial recieved from.....?
Vinod...
User avatar
desuvinodkumar
Senior Developer
Senior Developer
 
Posts: 102
Joined: Mon Mar 23, 2009 6:51 am
Location: India

Postby Nemat » Fri Sep 25, 2009 11:54 am

Hey desuvinodkumar

Have u get that done?

I mean is there anyway to get notified if a new email is received?if yes,How can we do that?
Nemat
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Thu Aug 21, 2008 3:16 pm
Location: Jaipur

Postby desuvinodkumar » Fri Sep 25, 2009 12:59 pm

HI Nemat

No inbuilt methods...

we need to writ the emaqil client application seperately....

right now it is not there.....
Vinod...
User avatar
desuvinodkumar
Senior Developer
Senior Developer
 
Posts: 102
Joined: Mon Mar 23, 2009 6:51 am
Location: India

Re: Email, Send, Intent, IntentChooser

Postby themaninthesuitcase » Fri Jan 08, 2010 4:15 pm

Dmitry.Skiba wrote:
plusminus wrote:Short snippet to start an Email-Activity with some preset data:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
  2. emailIntent .setType("plain/text");
  3. emailIntent .putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"webmaster@website.com"});
  4. emailIntent .putExtra(android.content.Intent.EXTRA_SUBJECT, mySubject);
  5. emailIntent .putExtra(android.content.Intent.EXTRA_TEXT, myBodyText);
  6. context.startActivity(Intent.createChooser(intent, "Send mail...));
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Wasted 30 minutes before I realised that type should be text/plain! Same for text/html. Please fix original message.


Did anyone get html emails to work? When I try text/html I just get the raw HTML in the message body, it won't render correctly either in the editor (gmail and HTC mail) or once sent. Also I notice HTC mail doesn't honour EXTRA_EMAIL!
themaninthesuitcase
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Dec 04, 2009 12:03 pm

Top

Using send Intent to share files

Postby comechao » Mon Jan 11, 2010 8:20 pm

[quote="snappy"]Thank you so much for this.

Is there a way to use the "share" intent which is used in the camera application or the picture viewer app so you can send by E-Mail or SMS and bundle the data depending on what is selected?[/quote]

Yes, you can try do somethinng like this: http://gist.github.com/274493
Just using the Intent.ACTION_SEND passing a file type and the Uri
comechao
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Jan 11, 2010 8:15 pm

Postby Sri » Wed Jan 27, 2010 11:18 am

Hi All,

How to Add Pop3/Imap4 account email Programatically?

I used "content://com.android.email.provider" Uri. But Android 1.5 API not supported that.

But through Emulator I added PoP3/Imap4 accounts. But i want to know the PATH where to store those id's,passwords,port numbers in Database.


Can anyone help me. I need urgent.


Thanks
Sri.
Sri
Developer
Developer
 
Posts: 25
Joined: Fri Dec 04, 2009 2:31 pm

Postby CMorgan2009 » Mon Mar 22, 2010 10:29 pm

I'm using the above code and can get the Subject and Message Body to work, but not the TO: nor CC: (for CC, I'm using EXTRA_CC).

Am I missing a Manifest permission? Thoughts?
CMorgan2009
Freshman
Freshman
 
Posts: 8
Joined: Sat Feb 20, 2010 9:16 pm
Location: San Diego, CA

Postby Rahul » Tue Mar 23, 2010 5:22 am

You can try something like this

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. sendIntent.putExtra(Intent.EXTRA_EMAIL,new String[]{"mailid@example.com"});
Parsed in 0.034 seconds, using GeSHi 1.0.8.4



CMorgan2009 wrote:I'm using the above code and can get the Subject and Message Body to work, but not the TO: nor CC: (for CC, I'm using EXTRA_CC).

Am I missing a Manifest permission? Thoughts?
Rahul
Experienced Developer
Experienced Developer
 
Posts: 89
Joined: Wed Oct 01, 2008 11:16 am

Re: Email, Send, Intent, IntentChooser

Postby Trip » Mon May 24, 2010 6:30 pm

very useful thanks for the post :D
Trip
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sat May 22, 2010 2:58 am

Re: Email, Send, Intent, IntentChooser

Postby sumit_android » Mon Jun 21, 2010 2:31 pm

if any one know about the custmization of email,then plz help me.
customization means how can i change the color of text in subject area or in Body area of mail.
Thnx in advance.
sumit_android
Junior Developer
Junior Developer
 
Posts: 19
Joined: Fri Feb 19, 2010 6:59 am
Location: India

Re: Email, Send, Intent, IntentChooser

Postby arjel06 » Thu Jun 24, 2010 4:43 am

Hello android, there are ways how you change the color of your text in the body of your email. You can add color codes besides the text you want to customize. That is I usually use to improve my email text codes.
Last edited by arjel06 on Fri Jun 25, 2010 4:31 am, edited 1 time in total.
arjel06
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Jun 24, 2010 2:48 am

Re: Email, Send, Intent, IntentChooser

Postby sumit_android » Thu Jun 24, 2010 5:15 pm

will you please give me some lines of code,that perform this task.
sumit_android
Junior Developer
Junior Developer
 
Posts: 19
Joined: Fri Feb 19, 2010 6:59 am
Location: India

Re: Email, Send, Intent, IntentChooser

Postby wizlon » Wed Jul 14, 2010 10:01 pm

For anyone wanting to add html to emails... Note the type on ln2... the magic happens on line 4 though, see the way we call Htm.fromHtml(String), this will build your HTML text into html the email app gets.

Code: Select all
1   final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
2   emailIntent.setType("text/html");
3   emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
4   emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
5   Intent.createChooser(emailIntent, "Email:");
6   startActivity(emailIntent);


Don't thank me as this was competeley stolen from here: http://blog.iangclifton.com/2010/05/17/sending-html-email-with-android-intent/
wizlon
Junior Developer
Junior Developer
 
Posts: 23
Joined: Mon Jan 07, 2008 2:17 pm

Top
PreviousNext

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 1 guest