Sending Email Using Titanium Developer Application
I am trying 开发者_运维问答to create application for sending Email from titanium developer application
[Code]
b.addEventListener('click', function() {
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.subject = "Hello from Titanium";
emailDialog.toRecipients = ['foo@yahoo.com'];
emailDialog.open();
});
[/Code]
it open pop up window for sending email.after composing mail when i click on send .
It is not sending mail.
Please Help
Thanks in Advance Pratik Asthana
try this from kitchenSink... I notice you are not using "setSubject" or "setToRecipients"
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.setSubject('Hello from Titanium!');
emailDialog.setToRecipients(['foo@yahoo.com']);
emailDialog.setCcRecipients(['bar@yahoo.com']);
emailDialog.setBccRecipients(['blah@yahoo.com']);
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();
精彩评论