insert html content in mail using intent - android

I need to send mail with html content.Html content is coming from back end .I have tried using Html.fromHtml and passed it to Intent.EXTRA_TEXT but I am not getting the desired result my html content contains images and hyperlink but after using Html.fromHtml i am getting text only
Intent intent = new Intent(Intent.ACTION_SEND);
String[] recipients = {"wantedEmail#gmail.com"};
intent.putExtra(Intent.EXTRA_EMAIL, recipients);
intent.putExtra(Intent.EXTRA_SUBJECT, "emailTitle:");
intent.putExtra(Intent.EXTRA_TEXT,Html.fromHtml(emailContent));
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_CC, "ghi");
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Send mail"));

intent.putExtra(Intent.EXTRA_TEXT, emailContent);
Putting that you should be able to get what you see

Related

How to make app picker for sharing text permanent in Android?

I'm trying to make refer and earn activity in my appSo I want to permanently display a few apps like whatsapp, etc for the user to click on them and share directly.I'm using Intent to share the referral code but it pops up the apps list when the user clicks share.The code I'm using is,
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "This is a message");
intent.setType("text/plain");
startActivity(Intent.createChooser(intent, "Share via"));
How can I make the app chooser permanent for a few apps?
The app chooser is not intended to be displayed permanently. Therefore you will have to create simple buttons or icons and create an intent that refers to the desired app directly, by setting the package of the intent.
E.g. to share sth with WhatsApp use sth like this:
Intent sendIntent = new Intent();
// here comes the magic
sendIntent.setPackage("com.whatsapp");
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);
Depending on the type of content you want to share and the apps you want to share with, it makes sense to reuse the code to create the intent and just set the respective package and eventually some additional parameters.
You will need package name of app and a Intent.
change ACTION_VIEW to ACTION_SENDTO
set the Uri as you did set the
package to whatsapp
Intent i = new Intent(Intent.ACTION_SENDTO,
Uri.parse("content://com.android.contacts/data/" + c.getString(0)));
i.setType("text/plain");
i.setPackage("com.whatsapp"); // so that only Whatsapp reacts and not the chooser
i.putExtra(Intent.EXTRA_SUBJECT, "Subject");
i.putExtra(Intent.EXTRA_TEXT, "I'm the body.");
startActivity(i);
You can refer this link for More:
Send text to specific contact (whatsapp)
Sending message through WhatsApp
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("*/*");
intent.setPackage("com.whatsapp");
intent.putExtra(Intent.EXTRA_TEXT, "your text content");
startActivity(intent)
I am facing same problem for share tamil font content in Whatsapp. I found the solution, this setType("*/*") share full content.

ACTION_SEND: Possible to filter applications which accept attachments?

I am trying to share text and attachment using ACTION_SEND.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"email"});
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, "body");
Uri uri = Uri.fromFile(file);
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Send..."));
However, in the list appear applications like Hangouts which do not accept attachments.
Can I filter out application which do not accept attachments? Is there a tag or another indicator which can tell me if application accepts attachments or not?
intent.setType("message/rfc822");
Use this.

share huge text via `intent.ACTION_SEND` on android

i want to share a huge text via Intent.ACTION_SEND; but it's just send a piece of my text... :|
this is my code
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, txt_Main.getText().toString());
startActivity(Intent.createChooser(intent, "Share via ..."));
thank you

Android how to get sent/received email information

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.

How can I launch android's email activity with an attachment attached in the email?

In my android, how can I launch android's compose email activity with an attachment attached?
Just launch an intent with the following structure:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"to#example.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "the subject");
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("the content"));
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/file.ext"));
startActivity(intent);
Notice that I'm using the complete path to the file: "file:///sdcard/file.ext". Also, take into account that you can share files that you have saved into the SDCard only (otherwise, the email client will ignore the file).

Categories

Resources