1. Download our Official Android App: Forums for Android!

Apps Sending email with HTML in body

Discussion in 'Android Development' started by murali.lancer, Feb 25, 2010.

  1. murali.lancer

    murali.lancer Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    18
    Joined:
    Sep 17, 2009

    Sep 17, 2009
    18
    1
    16
    Hello,

    I have been unable to send an email via an Intent where the email
    contains HTML in the body. The email is created, but the HTML in the
    body shows as plain text instead of being rendered as HTML. I have
    found similar posts where others have encountered the same problem,
    but so far no one has provided a solution.

    Here is a snippet of code to demonstrate:

    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("text/html");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]
    {"t...@email.com"});
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
    "Subject");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
    "<html><body>Example</body></html>");
    context.startActivity(Intent.createChooser(emailIntent, "Send
    mail..."));


    thanks and regards
    murali dhuli
    android developer
     

    Advertisement

  2. alostpacket

    alostpacket Over Macho Grande?
    Rank:
    None
    Points:
    513
    Posts:
    7,973
    Joined:
    Nov 29, 2009

    Nov 29, 2009
    7,973
    3,603
    513
    Android App Developer
    NY
    It's not possible at the moment as far as I know. I looked high and low to make this work in my app but the email app and gmail both invariably switch the mime type back to text/plain. Not sure if it is due to a bug or a weird undocumented security "feature"

    However you can attach an html document.
     

Share This Page

Loading...