Android how to get sent/received email information - android

Hello I am just curious about.
From Message Inbox/Outbox. we can retrieve :phone number,message body,date,locked status,StatusOnSim etc.
So Can we retrieve from email (sent+inbox):Email_id,Subject,Body,CC,BCC etc.
I want to retrive all this thing from my email like Email_id,Subject,Body,CC,BCC etc
if any one have idea regarding this than please help me on it.

Code to send email information:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {
"ur mail id" });
intent.putExtra(Intent.EXTRA_SUBJECT, "ur subject");
intent.putExtra(Intent.EXTRA_TEXT, "ur text");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(FileName));
startActivity(Intent.createChooser(intent, "Choose"));
it cant retrieve data like Email_id,Subject,Body,CC,BCC etc from ur mail box. But it possible in Message inbox.

Related

How can I create a simple program that it can send a text to a gmail address?

How can I create a simple program that it can send a text to a gmail address?
I want to create a simple program that it have a EditText and when I write some text in the EditText and I click on the Button, as the result the text be sent to a gmail address, for example to the example#gmail.com. I know how to create a EditText class but I do not know the operation post to the gmail. Thank you.
In Android, you can use Intent.ACTION_SEND to call an existing email client to send an Email.
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"put_your_mail#gmail.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "subject");
email.putExtra(Intent.EXTRA_TEXT, "message");
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client :"));
For more details you visit How to send Email in Android and
http://code.tutsplus.com/tutorials/quick-tip-enabling-users-to-send-email-from-your-android-applications-the-easy-way--mobile-1686
Standard way to do this is using the ACTION_SEND intent
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, "emailaddress#emailaddress.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT, "I'm email body.");
startActivity(Intent.createChooser(intent, "Send Email"));
If you want to send the mail in background without opening another app check this answer https://stackoverflow.com/a/2033124/2761055
Here, you have information how to do that in background with PHP file on your server.
But in my opinion, this method is deprecated.
Look also here. This code will start new intent with email.

How to send mail from Gmail in android?

I am building an android application where an user is required to lo-gin using g+ to enter in the app. After lo-gin there is 3 EditTextView where user enter required data respect to their field to send mail. the field like - recipient mail Id, subject, and body.
Now the problem is How to send the mail to that recipient ID. using my app.
Here you go:
https://stackoverflow.com/a/2197841/3498044
https://stackoverflow.com/a/6264746/3498044
Next time search before you ask
Try with Following
private String[] recipients = {"abc#gmail.com"};
private String type = "text/html";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, recipients);
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT, "text");
intent.setType(type);
startActivity(Intent.createChooser(intent, "Send mail"));

Sending an email via an intent

I am currently working on an android project and I am adding a preference to be able to send me an email. I am using the ACTION_SENDTO intent to send the email but its coming back and says No apps can perform this action.
Below is the code I am using
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, "someone#example.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "Check out this android app");
intent.putExtra(Intent.EXTRA_TEXT, "Check out this new app in the Google Play Store. Its from Boardies IT Solutions and is called Boardies Password Manager. You can find it at https://play.google.com/store/apps/details?id=com.BoardiesITSolutions.PasswordManager");
startActivity(Intent.createChooser(intent, "Send Email"));
Thanks for any help you can provide
You need to add the following
intent.setData(Uri.parse("mailto:" + "email#bla.com")); // leave
blank if not specificity
I think you should replace Intent.ACTION_SENDTO to Intent.ACTION_SEND,
Hope this will work for you.
How about this code:
final Intent emailLauncher = new Intent(Intent.ACTION_SEND);
emailLauncher.setType("message/rfc822");
emailLauncher.putExtra(Intent.EXTRA_EMAIL, "username#domain.com");
emailLauncher.putExtra(Intent.EXTRA_SUBJECT, "check this subject line");
emailLauncher.putExtra(Intent.EXTRA_TEXT, "hey check this message body!");
try{
startActivity(emailLauncher);
}catch(ActivityNotFoundException e){
}

How to send an email in android 2.2?

I want to send an email with android 2.2. First I made an intent chooser with an ACTION_SEND to select which to use :
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, Resources.getString("EmailInvitationSubject", getBaseContext()));
String body = Resources.getString("EmailInvitationBody", getBaseContext()) + Local.User.FirstName;
intent.putExtra(Intent.EXTRA_TEXT, body);
startActivity(Intent.createChooser(intent, "Invite friends"));
But in that case, the selector show 'Bluetooth, Messaging, Google+, Gmail'. I want to show ONLY Gmail or other email app.
I saw in the sdk docs there's a new CATEGORY_APP_EMAIL to use but it's only available in the API level 15. I have to keep API level 8. Is there a way to do that ?
By the way, I'll want to do it for messaging too so that in the end I can have 2 buttons: one for email and one for messaging.
This code will shows only the email clients,
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"youremail#yahoo.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "subject");
email.putExtra(Intent.EXTRA_TEXT, "message");
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client :"));
You might want to checkout following (to get what you are looking at the end, i.e. "....By the way, I'll want to do it for messaging too so that in the end I can have 2 buttons: "):
http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android
or also you could checkout:
Android email chooser
Kind regards,
Bo

Getting the recepient count from email sent in Android

I'm launching the email program in Android from my app, using the following code...
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("message/rfc822");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Test subject");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Hello World!");
startActivityForResult(Intent.createChooser(sendIntent, "Select email application."), INTENT_REQUEST_SEND_EMAIL);
In the called OnActivityResult(), is it possible to get the number of recepients the user has chosen to send the email to?
Thanks,
Rajath
That action does not support startActivityForResult(), sorry.

Categories

Resources