I have generated an HTML code(complete with <html><body></body></html>
tags) as a String. Now I want to send this HTML code as HTML to mail. My code is as below.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"me@mydomain.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "I would like to buy the following");
intent.putExtra(Intent.EXTRA_TEXT, purchaseOrder());
startActivity(Intent.createChooser(intent, "sending mail"));
Where the purchaseOrder()
is the method which passes me the string having full HTML code. But though the GMail client opens on my Nexus1 but it has the String with all HTML tags and not the actual HTML view. I tried the following but got error. The GMail crashed.
intent.putExtra(Intent.EXTRA_STREAM, purchaseOrder());
if i am not wrong what you were looking for was
e.g.
this will make Google a hyperlink
For anyone else looking to do this, sending the email manually behind the scenes using android-javamailer works (I've done it):
http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android
This works for me:
But I've notice that inline styles and image tags are being ignored...
This worked for me
Intent.ACTION_SENDTO
and my code goes here: