我正在尝试使用 Kony Studio 版本5中的JavaScript发送附件(这样做的目的是提供一封可以阅读的 vCard联系人的电子邮件iPhone或Android设备。)
不幸的是,文档很少,我无法让它工作。 这是我正在尝试的:
var attachmentBody = "this would be the vCard contact as simple text!";
var attachments = { "mimetype" : "text/vcard", "attachment" : attachmentBody };
var msgBody = "Hello from the message body...";
kony.phone.openEmail(to, cc, bcc, sub, msgBody, false, attachments);
这根本不提供附件。 :(
答案 0 :(得分:1)
只是打电话给这个论坛上的人们:这个答案在Kony论坛上得到了答复:http://developer.kony.com/konyforum/viewtopic.php?id=3900
function generateVCard(){
var email=frmDetails.lblEmail.text;
var off=frmDetails.lblOff.text;
var mob=frmDetails.lblMob.text;
var fullName = frmDetails.lblName.text
var lname= frmDetails.lbllname.text;
var fname=frmDetails.lblfname.text
var offName= frmDetails.lblLocOff.text;
var jbTitle = frmDetails.lblDetDesg.text
var conList = "BEGIN:VCARD\r\n";
conList += "VERSION:3.0\r\n";
conList += "N:"+lname+";"+fname+"\r\n";
conList += "FN:"+fullName+"\r\n";
conList += "ORG:"+offName+"\r\n";
conList += "TITLE:"+jbTitle+"\r\n";
conList += "TEL;TYPE=WORK,VOICE:"+off+"\r\n";
conList += "TEL;TYPE=HOME,VOICE:"+mob+"\r\n";
conList += "ADR;TYPE=WORK:"+offName+"\r\n";
conList += "EMAIL;TYPE=PREF,INTERNET:"+email+"\r\n";
conList += "END:VCARD\r\n";
kony.print("VCF : "+conList);
var encStr = Base64.encode(conList);
kony.print("Encoded string - : "+encStr);
var rawStr = kony.convertToRawBytes(encStr);
return rawStr;
}
function mailAttach(){
kony.print("Email id:");
var lname= frmDetails.lbllname.text;
var fname=frmDetails.lblfname.text
var fulName = fname +"_"+ lname+".vcf";
kony.print("FULLNAME:"+fname +"_"+ lname);
var to=[];
var cc=[];
var bcc = [];
var sub = "Get Connected with "+fname+" "+lname;
var msgbody = "";
var rawBytes = generateVCard();
kony.print(rawBytes);
tab= [ { mimetype : "text/x-vcard", attachment : rawBytes , filename : fulName }];
kony.print("tab>>>>");
kony.print(tab);
kony.phone.openEmail(to, cc, bcc, sub, msgbody,false, tab);
kony.print("after open email");
}
答案 1 :(得分:0)
这不能直接使用kony apis实现。 您必须使用本机功能,然后在kony中将其用作FFI(外部函数接口)。 这里是FFI更多细节的链接 https://www.linkedin.com/groups/Foreign-Function-Interface-most-powerful-4981807.S.256063126