How to send email with multiple image file as attachment? . I tried but the last chosen image is only being attached in mail, other images are not attaching. I am using Titanium 3.x and platform is android.
My code is
```
function ShowEmailWindow() {
setTimeout(function() {
var emailDialog = Ti.UI.createEmailDialog();
emailDialog.subject = "Harcourts";
emailDialog.toRecipients = [''];
emailDialog.messageBody = 'Thank you ';
if (Ti.Platform.osname == 'android') {
for (var k = 0; k < count; k++) {
if(k == 0){
emailDialog.addAttachment(thePhoto1.toImage().media);
}
else if(k == 1){
emailDialog.addAttachment(thePhoto2.toImage().media);
}
else if(k == 2){
emailDialog.addAttachment(thePhoto3.toImage().media);
}
}
} else {
emailDialog.addAttachment(mainView.toImage());
}
emailDialog.addEventListener('complete', function(e) {
if (e.result == emailDialog.SENT) {
if (Ti.Platform.osname != 'android') {
// android doesn't give us useful result codes.
// it anyway shows a toast.
alert("email sent successfully");
}
} else {
alert("message was not sent. result = " + e.result);
}
});
emailDialog.open();
}, 100);
}
```
↧