Email dialog HTML ignores some tags

You must Login before you can answer or comment on any questions.

I'm currently building an app that has Email sending capabilities. I'm trying to send an Email with the relevant information and includes a link to the original post that is being sent. the original post is created as an HTML code segment, so I have to send the Email as an HTML. i create the Email dialog like this:

var mail = Ti.UI.createEmailDialog({
    subject:'FW:'+post.desc,
    html:true,
    messageBody: '<br><br><a href="http://www.XXXXXXXX.com/index.php?tid='+post.id+'" target="_blank">view original post</a><br><br><b style="font-size:1.5em;font-family:Arial">'+post.desc+'</b><br><br><i>'+metaData.text.toString().replace(/\n/g,'<br>')+' </i><br><br>'+post.htmlData
});
Ti.API.debug(mail.messageBody)
mail.open();
when I ran the app on my device, I got the option of sending via "mail" or via "Gmail". when sent via "mail", all the link tabs and <b> and <i> were ignored and striped so the Email didn't include them. however, the "Gmail" option left everything as suppose to.

any thoughts?

— asked 1 year ago by mo joe
1 Comment
  • BTW, I'm using SDK v1.7.5

    — commented 1 year ago by mo joe

1 Answer

Accepted Answer

Well, unfortunately, the Android's default Mail App cannot display html mail contents as it is explained here.

This is a limitation from the mail app itself and has nothing to do with your code. (You can try to send a html message from your PC and read it with the default app. You will experience the same problem)

You can take little comfort though that unlike iOS. Most people don't use the default mail app on Android (this is only from my experience, so it can differ). People use the gmail or the new hotmail app in most cases.

— answered 1 year ago by Christian Brousseau
answer permalink
3 Comments
  • is there a way to force the use of Gmail client?

    — commented 1 year ago by mo joe

  • Unfortunately, this can only be chosen by the device's owner. So the answer is no.

    — commented 1 year ago by Christian Brousseau

  • I have the same problem. i want to share html content with mail. my code :

    var emailDialog = Titanium.UI.createEmailDialog();
        emailDialog.html = true;
        emailDialog.subject = toShare.mail.title;
        emailDialog.messageBody = "....<img src='http://remote.png' />....";
        emailDialog.open();
    with gmail or default browser. it is the same., i see obj in the mail instead of my image.

    thanks

    — commented 2 weeks ago by Djamel ZAHAL

Your Answer

Think you can help? Login to answer this question!