如何通过Titanium移动应用程序发送电子邮件。 我收到“localhost denied”的错误
答案 0 :(得分:3)
我猜你使用像mailto:email@mydomain.com
这样的东西。
您应该使用电子邮件对话框:http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.EmailDialog-object
这应该适合你。
var emailDialog = Titanium.UI.createEmailDialog()
emailDialog.subject = "Hello from Titanium";
emailDialog.toRecipients = ['foo@yahoo.com'];
emailDialog.html = '<b>Appcelerator Titanium Rocks!</b>';
emailDialog.open();
如果您想在没有对话框的情况下发送电子邮件,请尝试对网络服务器进行AJAX调用,然后在服务器上发送。
无法在没有对话框的情况下将其发送到手机上。
答案 1 :(得分:0)
这个披萨订购应用教程根据用户选择发送电子邮件。
http://mobile.tutsplus.com/tutorials/appcelerator/titanium-mobile-build-a-pizza-ordering-app/
答案 2 :(得分:0)
var emailDialog = Ti.UI.createEmailDialog();
emailDialog.subject = "Checkout this Mail";
emailDialog.toRecipients = ['ebrahim.3bmo3ty@gmail.com'];
emailDialog.setMessageBody("we sending email here");
emailDialog.open();
答案 3 :(得分:0)
使用此选项: -
mail.addEventListener('click', function(e) {
var emailDialog = Titanium.UI.createEmailDialog();
if (!emailDialog.isSupported()) {
Ti.UI.createAlertDialog({
title:'Error',
message:'Email not available on this device.'
}).show();
return;
}
emailDialog.setSubject(' Gmail !!!!!!!! ');
emailDialog.setToRecipients(['abc@gmail.com']);
emailDialog.setMessageBody('Hi,\n I am working with appcelerator.');
emailDialog.setHtml(false);
emailDialog.setBarColor('#336699');
emailDialog.addEventListener('complete',function(e){
if (e.result == emailDialog.SENT){
if (Ti.Platform.osname != 'android'){
alert("message was sent");
}
}else{
alert("message was not sent. " );
}
});
}
斯巴达克斯谢谢:)