Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-2007, 07:42 PM
Junior Member
 
Posts: 5
Default Send mail in zimlet ext

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>&lt;html&gt;&lt;head&gt;&lt;style type='text/css'&gt;body
{ font-family: 'Arial'; font-size: 12pt; color: #000000}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;This
is the message content&lt;br&gt;&lt;/body&gt;&lt;/html&gt;</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.

Last edited by lix830917; 04-28-2007 at 12:02 AM..
Reply With Quote
  #2 (permalink)  
Old 06-19-2007, 06:14 AM
Loyal Member
 
Posts: 97
Default One problem I see...

This makes your zimlet very Internet Explorer specific. This code will not work in firefox. The main idea behind the Zimbra framework is it is browser independent. If you can get the code correct, it will generate the correct information for the browser the users is using. The problem is, the zimbra framework is a bit complicated.
__________________
EricX
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.