Image attached to Email not showing in Gmail or OSX Mail

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

I am looking for a way to send a png file over email so that it appears in email clients properly. I have been using the below code and the pic shows in the iPad email client, but not in OSX Mail or in Gmail. Its is there as an attachment, but doesn't show at all. The app is running on iOS (universal).

here is the code

var emailDialog = Titanium.UI.createEmailDialog();
 
var image = Titanium.Filesystem.getFile(imageurl);
 
// Set up font variables
var font = Titanium.App.Properties.getString("fontfamily",'Arial');
var fontsize = Titanium.App.Properties.getString("fontsize",'20');
var fontcolor = Titanium.App.Properties.getString("fontcolor",'red');
 
//Assemble the email
emailDialog.subject = "subject";
emailDialog.barColor='red';
emailDialog.messageBody ='<br><b style="font-size:'+fontsize+'px;font-family:'+font+';color:'+fontcolor+';textAlign=center">'+detailWindow._description+'</b><br><br>'
emailDialog.setHtml(true);
emailDialog.addAttachment(image);  
emailDialog.open();
I also tried changing the attachment to below after reading it maybe something like a, but it doesn't work at at all.
emailDialog.addAttachment({mimeType:'image/png',file:image});

2 Answers

Hi, as i noticed u attached the png in mail so mail take is attached document and send as attached file. If u want to add the png in massage body u have to add the png in html format in the massage body. may be this is not ur exactly solution please elaborate ur problem more specifically then again i will try.....

In the end I found that changing the images to jpegs seemed to totally fix the problem. Would love to know what causes the issue with .png Is this a bug in Titanium?

Your Answer

Think you can help? Login to answer this question!