Results 1 to 3 of 3

Thread: [SOLVED] Attach file from URL

  1. #1
    Join Date
    Jan 2009
    Location
    Denmark
    Posts
    7
    Rep Power
    6

    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

  2. #2
    Join Date
    Jan 2009
    Location
    Denmark
    Posts
    7
    Rep Power
    6

    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 Attached Files

  3. #3
    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    4

    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

Similar Threads

  1. bayes db..
    By osiris in forum Administrators
    Replies: 9
    Last Post: 06-15-2011, 12:14 PM
  2. speed up the net
    By mcesari in forum Administrators
    Replies: 10
    Last Post: 04-25-2008, 12:24 PM
  3. centos 5 zimbra 4.5.6 no statistics
    By rutman286 in forum Installation
    Replies: 9
    Last Post: 08-14-2007, 10:30 AM
  4. Traslation SVN tree status
    By meikka in forum I18N/L10N - Translations
    Replies: 7
    Last Post: 02-13-2007, 11:13 AM
  5. M3 problem with shares
    By titangears in forum Users
    Replies: 4
    Last Post: 01-12-2006, 01:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •