I want to send a mail from my zimlet,If I want to send a soap request in my javascript code,What should I do for this?The code below works?
function send_request(){
var url="servername\service\soap\SendMsgRequest";
var xml="<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra">
<userAgent name="ZimbraWebClient - FF2.0 (Win)" version="4.5.4_GA_763.FC4"/><sessionId id="111" />
<change token="59553" type="new"/>
<authToken>(REMOVED)</authToken>
<format type="js"/></context>
</soap:Header>
<soap:Body>
<SendMsgRequest xmlns="urn:zimbraMail" suid="1177704687970"> <m idnt="2199a0c6-568b-11da-92a1-efa4f3028220"><e t="t" a="josh@hisdomain.com"/>
<e t="f" a="josh@hisdomain.com" p="Joshua R. Prismon"/>
<su>This is the message title</su>
<mp ct="multipart/alternative">
<mp ct="text/plain">
<content>This is the message content </content>
</mp>
<mp ct="text/html"><content><html><head><style type='text/css'>body
{ font-family: 'Arial'; font-size: 12pt; color: #000000}</style></head><body>This
is the message content<br></body></html></content></mp></mp></m></SendMsgRequest>
</soap:Body></soap:Envelope>";
if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
}
else if(window.ActiveXObject){
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
http_request.onreadystatechange=processRequest;
http_request.open("POST",url,false);
//http_request.setRequestHeader("Content-Type","text/xml");
http_request.send(xml);
}
I don't know weather this method works,Are there any exist functions better than above?
if without using soap,Are there other class or method or library for sending a mail in zimlet's javascript code?
Thanks for your attention,I'll be so appreciate if you can show any detail about it.


LinkBack URL
About LinkBacks

