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 01-08-2009, 02:48 AM
Junior Member
 
Posts: 7
Default [SOLVED] Attach file from URL

Hi there

In a Zimlet I'm developing (primarily in JavaScript), one function needs to take an URL and attach the contents of the response to an email. I can call the mail composer alright, but not attach the file.

Basically, I need to create a servlet similar to the FileUploadServlet, that gets it's data from a specified URL rather than the contents of the POST request. Getting the contents is easy enough, so consider cloning FileUploadServlet.java to be done. Now, where should the class file be placed so it is reachable from the Zimlet, and how can I specifically access it from the JavaScript of the Zimlet and attach it to the mail (I guess some kind of SOAP is needed)

The following code works for me, except I don't have the attachment id:

var msg = new ZmMailMsg();
msg.setSubject("Message subject test");
msg.addAttachmentId(att.aid); // <= I guess this is what I need returned

var params={
action: ZmOperation.FORWARD,
msg: msg
};

var composeController=AjxDispatcher.run("GetComposeCon troller");
composeController.doAction(params);

Any help will be greatly appreciated. Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 01-16-2009, 03:26 AM
Junior Member
 
Posts: 7
Default

I did a workaround of the problem, so instead of a servlet replicating the behavior of FileUploadServet, I made a JSP page that gets the data from the url(s) and posts it to FileUploadServlet with the org.apache.commons.httpclient (already in zimbra). It is reached from the zimlet javascript using a plain AJAX call. So I guess that's a problem solved.

If anyone's interested, the JSP code is attached to this post.
Attached Files
File Type: zip attach.jsp.zip (1.5 KB, 70 views)
Reply With Quote
  #3 (permalink)  
Old 07-26-2011, 08:23 AM
Starter Member
 
Posts: 1
Default

Quote:
Originally Posted by Lapeth View Post
I did a workaround of the problem, so instead of a servlet replicating the behavior of FileUploadServet, I made a JSP page that gets the data from the url(s) and posts it to FileUploadServlet with the org.apache.commons.httpclient (already in zimbra). It is reached from the zimlet javascript using a plain AJAX call. So I guess that's a problem solved.

If anyone's interested, the JSP code is attached to this post.
I'll see, thks
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.