Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Add image in email body on android

$
0
0

Hi,

I want to add image as html in email body. But it show "obj" in email on android. Find below my code.

function openEmailDialog() {
    var body = "<html><body>";
    for ( i = 0; i < Alloy.Globals.chatHistory.length; i++) {
        var chat = Alloy.Globals.chatHistory[i];
        if (chat.user != "info") {
            if (chat.type == "image") {
 
                var encodedImage = Ti.Utils.base64encode(selectedImage.toStrin()).toString();
                body = body + "<b>" + chat.user + " : </b><img src='data:image/png;base64," + encodedImage + "' /><br />";
            } else {
                body = body + "<b>" + chat.user + " : </b>" + chat.message + "<br />";
            }
        }
    }
    body = body + "</body></html>";
    var emailDialog = Ti.UI.createEmailDialog();
    emailDialog.setHtml("true");
    emailDialog.subject = "Live Chat History";
    emailDialog.toRecipients = [];
    emailDialog.messageBody = body;
    emailDialog.open();
}
Anyone has solution for this?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>