試試這個從的KitchenSink ......我沒有使用 「SETSUBJECT」 或 「setToRecipients」
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.setSubject('Hello from Titanium!');
emailDialog.setToRecipients(['[email protected]']);
emailDialog.setCcRecipients(['[email protected]']);
emailDialog.setBccRecipients(['[email protected]']);
if (Ti.Platform.name == 'iPhone OS') {
emailDialog.setMessageBody('<b>Appcelerator Titanium Rocks!</b>å');
emailDialog.setHtml(true);
emailDialog.setBarColor('#336699');
} else {
emailDialog.setMessageBody('Appcelerator Titanium Rocks!');
}
// attach a blob
emailDialog.addAttachment(event.media);
// attach a file
var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'cricket.wav');
emailDialog.addAttachment(f);
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("message was sent");
}
}
else
{
alert("message was not sent. result = " + e.result);
}
});
emailDialog.open();
通知