Quantcast
Channel: Zimbra :: Forums - Zimlets
Viewing all 171 articles
Browse latest View live

Import email from a zimlet

$
0
0
Hi,

I am currently developing a Zimlet that allows to export / import an email with a simple drag and drop.
I can export this fact without any worries.

My problem is import, I can export an email only if I know the user's password.
I want to import an email without needing his password.

I looked for the preauth.jsp script, but without success.

preauth.jsp :

Code:

<%@ page import="java.security.InvalidKeyException" %>
<%@ page import="java.security.NoSuchAlgorithmException" %>
<%@ page import="java.security.SecureRandom" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.TreeSet" %>
<%@ page import="javax.crypto.Mac" %>
<%@ page import="javax.crypto.SecretKey" %>
<%!
 public static final String DOMAIN_KEY =
        "f28d68f8d7*****";


 public static String generateRedirect(HttpServletRequest request, String name) {
    HashMap params = new HashMap();
    String ts = System.currentTimeMillis()+"";
    params.put("account", name);
    params.put("by", "name"); // needs to be part of hmac
    params.put("timestamp", ts);
    params.put("expires", "0"); // means use the default

    String preAuth = computePreAuth(params, DOMAIN_KEY);
    return request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/service/preauth/?" +
          "account="+name+
          "&by=name"+
          "&timestamp="+ts+
          "&expires=0"+
          "&preauth="+preAuth;
  }

    public static  String computePreAuth(Map params, String key) {
        TreeSet names = new TreeSet(params.keySet());
        StringBuffer sb = new StringBuffer();
        for (Iterator it=names.iterator(); it.hasNext();) {
            if (sb.length() > 0) sb.append('|');
            sb.append(params.get(it.next()));
        }
        return getHmac(sb.toString(), key.getBytes());
    }

    private static String getHmac(String data, byte[] key) {
        try {
            ByteKey bk = new ByteKey(key);
            Mac mac = Mac.getInstance("HmacSHA1");
            mac.init(bk);
            return toHex(mac.doFinal(data.getBytes()));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("fatal error", e);
        } catch (InvalidKeyException e) {
            throw new RuntimeException("fatal error", e);
        }
    }
   
   
    static class ByteKey implements SecretKey {
        private byte[] mKey;

        ByteKey(byte[] key) {
            mKey = (byte[]) key.clone();;
        }

        public byte[] getEncoded() {
            return mKey;
        }

        public String getAlgorithm() {
            return "HmacSHA1";
        }

        public String getFormat() {
            return "RAW";
        }
  }

    public static String toHex(byte[] data) {
        StringBuilder sb = new StringBuilder(data.length * 2);
        for (int i=0; i<data.length; i++ ) {
          sb.append(hex[(data[i] & 0xf0) >>> 4]);
          sb.append(hex[data[i] & 0x0f] );
        }
        return sb.toString();
    }

    private static final char[] hex =
      { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' ,
        '8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f'};


%><%
String redirect = generateRedirect(request,"user@domain");
response.sendRedirect(redirect);

%>
<html>
<head>
<title>Pre-auth redirect</title>
</head>
<body>

You should never see this page.

</body>
</html>

Then the user selects a mail to import and execute a query with php curl :

Code:

$_url = "http://server/zimbra/home/".$user."/inbox/";
$post = array(
        "file_box"=>"@".$urlMail,
    );
$user_pass = "login:pssword";

curl_setopt($crl, CURLOPT_URL, $_url);
    curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($crl, CURLOPT_USERPWD, $user_pass); // I need to delete this line
    curl_setopt($crl, CURLOPT_POST, 1);
    curl_setopt($crl, CURLOPT_POSTFIELDS, $post);
    curl_exec($crl);
    //This is for debugging
    $info = curl_getinfo($crl);
    foreach ($info as $key=>$value) {print "$key -> $value <br/> ";}
    //cleanup curl and close the file
    curl_close($crl);

this script works only with login: password.

I think that the solution lies in the cookie ZM_AUTH_TOKEN.
If someone can help me plz.

Import email from a zimlet

$
0
0
Hi,

I am currently developing a Zimlet that allows to export / import an email with a simple drag and drop.
I can export this fact without any worries.

My problem is for the import, I can import an email only if I know the user's password .

I want to import an email without needing his password.

I looked for a preauth.jsp script , but without success.

my preauth.jsp :

Code:

<%@ page import="java.security.InvalidKeyException" %>
<%@ page import="java.security.NoSuchAlgorithmException" %>
<%@ page import="java.security.SecureRandom" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.TreeSet" %>
<%@ page import="javax.crypto.Mac" %>
<%@ page import="javax.crypto.SecretKey" %>
<%!
 public static final String DOMAIN_KEY =
        "f28d68f8d7*****";


 public static String generateRedirect(HttpServletRequest request, String name) {
    HashMap params = new HashMap();
    String ts = System.currentTimeMillis()+"";
    params.put("account", name);
    params.put("by", "name"); // needs to be part of hmac
    params.put("timestamp", ts);
    params.put("expires", "0"); // means use the default

    String preAuth = computePreAuth(params, DOMAIN_KEY);
    return request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/service/preauth/?" +
          "account="+name+
          "&by=name"+
          "&timestamp="+ts+
          "&expires=0"+
          "&preauth="+preAuth;
  }

    public static  String computePreAuth(Map params, String key) {
        TreeSet names = new TreeSet(params.keySet());
        StringBuffer sb = new StringBuffer();
        for (Iterator it=names.iterator(); it.hasNext();) {
            if (sb.length() > 0) sb.append('|');
            sb.append(params.get(it.next()));
        }
        return getHmac(sb.toString(), key.getBytes());
    }

    private static String getHmac(String data, byte[] key) {
        try {
            ByteKey bk = new ByteKey(key);
            Mac mac = Mac.getInstance("HmacSHA1");
            mac.init(bk);
            return toHex(mac.doFinal(data.getBytes()));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("fatal error", e);
        } catch (InvalidKeyException e) {
            throw new RuntimeException("fatal error", e);
        }
    }
   
   
    static class ByteKey implements SecretKey {
        private byte[] mKey;

        ByteKey(byte[] key) {
            mKey = (byte[]) key.clone();;
        }

        public byte[] getEncoded() {
            return mKey;
        }

        public String getAlgorithm() {
            return "HmacSHA1";
        }

        public String getFormat() {
            return "RAW";
        }
  }

    public static String toHex(byte[] data) {
        StringBuilder sb = new StringBuilder(data.length * 2);
        for (int i=0; i<data.length; i++ ) {
          sb.append(hex[(data[i] & 0xf0) >>> 4]);
          sb.append(hex[data[i] & 0x0f] );
        }
        return sb.toString();
    }

    private static final char[] hex =
      { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' ,
        '8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f'};


%><%
String redirect = generateRedirect(request,"user@domain");
response.sendRedirect(redirect);

%>
<html>
<head>
<title>Pre-auth redirect</title>
</head>
<body>

You should never see this page.

</body>
</html>

Then the user selects a mail to import an I execute a php query with curl :

Code:

$_url = "http://server/zimbra/home/".$user."/inbox/";
$post = array(
        "file_box"=>"@".$urlMail,
    );
$user_pass = "login:pssword";

curl_setopt($crl, CURLOPT_URL, $_url);
    curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($crl, CURLOPT_USERPWD, $user_pass); // I need to delete this line.
    curl_setopt($crl, CURLOPT_POST, 1);
    curl_setopt($crl, CURLOPT_POSTFIELDS, $post);
    curl_exec($crl);
    //This is for debugging
    $info = curl_getinfo($crl);
    foreach ($info as $key=>$value) {print "$key -> $value <br/> ";}
    //cleanup curl and close the file
    curl_close($crl);

this script works only if we know login: password.

I think that the solution lies in the cookie ZM_AUTH_TOKEN.
if someone can help me plz.

DwtListView Sample

$
0
0
Hi, I'm new to zimlet. Is there anyone who has example on how to use DwtListView? and how to render it inside the tab application main content area.

Thanks :confused:

Calendar auto-emails someone

$
0
0
I want to be able to have a calendar set up so that it automatically emails my wife when I add an event to it. I don't want this for all calendars and I want to be able to manage who gets the notices. Have you come across anything like this zimbra world?

Dave

Zimlet Development :: Protocol Flow :: Security concerns with iFrame.

$
0
0
Hello.

I am currently investigating how to write a custom zimlet. First I need to understand technically what the http protocol flow will be for my zimlet because there are security concerns. First, here is my current production zimbra environment.

browser from public ip:443 ---> firewall/router/NAT ---> apache2 reverse proxy:443 ---> zimbra:80
---> apache2 reverse proxy:443 ---> application servers:80 ---> DBMS servers:80

Apache2 reverse proxies are https servers all other servers are http.

My zimbra, application servers and DBMS servers and the like all operate using the http protocol behind the reverse proxies/firewalled.

My plan is to write a series of zimlets that will use zimlet iframes to capture application server data within the zimbra public ip browser.
The application servers are on the same lan that will feed the zimlets.

Somehow I want to code the zimlet to use the private url on port 80 to feed the iframe with application data. Is there a way to code a zimlet iframe using a private url within a public url to get this data back and forth over the secure:443 zimbra reverse proxy?

Desired protocol:

browser from public ip:443 ---> firewall/router/NAT ---> apache2 reverse proxy:443 ---> zimbra:80 ---> iframe zimlet:80 [embeded private url within public url?]
|
-------> application servers:80
|
--------> DBMS servers:80

[Javascript API] How to call webservices ?

$
0
0
Hi.

I can't find any good documentation about how to call webservices in javascript.

I found API entries for sendRequest and AjxCallback but neither shows a code example about how to call webservices using those (if they're all that's needed).

I also found this RSS Zimlet tutorial Develop an example RSS Zimlet - Zimbra :: Wiki but it doesn't explain enough the webservice part.

Any suggestion really appreciated.

Canvas won't open

$
0
0
Hi. I want to open a new window on Google when I drop a contact on this zimlet. This code doesn't do that


Code:

<zimlet name="fr_feeder_exemple_1" version="0.1" description="Demo DnD">
<!-- cette ligne détermine le type de notre zimlet : il sera mis dans le panneau de gauche -->
  <includeCSS>style.css</includeCSS> <!-- notre fichier de style, pour inclure une icône par exemple -->
  <zimletPanelItem label="Google Map Locator" icon="icone">
    <!-- une bulle qui s'affichera quand on passera la souris sur notre zimlet -->
    <toolTipText>Glissez/déposez un contact pour le localiser sur une carte.</toolTipText>
    <!-- cette balise permettra à notre zimlet de recevoir des contacts -->
    <dragSource type="ZmContact">
      <canvas type="window" />
      <actionUrl target="www.google.fr" />
    </dragSource>
  </zimletPanelItem>
</zimlet>

I am using this version of ZDesktop on linux :

Code:

        Zimbra Desktop 7.1.4 GA (build 11299)        Zimbra Desktop 7.1.4 GA (build 11299)
I aslo created a com_zimbra_openalldomains zimlet.

What am I missing ?

Thanks.

Panel zimlet to display a list of links

$
0
0
Hi!

I would like to develop a zimlet, that would display a list of links in the left panel, below the "Zimlets" section.

This zimlet would not be even visible within the "Zimlets section", but would only provide content, similar to calendar view, which is displayed at the bottom of the left pane.

How would I got about implementing this type of zimlet? I guess this is not a regular panel zimlet?

Thanks!

Asterisk UC Integration

$
0
0
Zimbra 8 looks great! I really like the new "Voice" tab for unified communications with Cisco and Mitel but unfortunately I do not see anything out there for Asterisk.:( Does anyone know if this is beeing worked on by anybody?

Thanks in advance!

Why is my button disabled at creation time ?

$
0
0
Hi.

My zimlet creates a button both in the message composer toolbar and in the contact editor toolbar. First is created properly, second is created but is disabled. Am I doing something wrong ?

Code:

// Création de variables globales pour jouer avec dans firebug
// application, toolbar, controller et viewID
// préfixé d'un D pour débug.

Dapplication = null;
Dtoolbar    = null;
Dcontroller  = null;
DviewID      = null;

// Création d'une nouvelle propriété initialisée à false.
SugarBee.addContactButtonCreated = false;
SugarBee.addMailButtonCreated = false;

SugarBee.prototype.initializeToolbar = function(app, toolbar, controller, viewID){
    Dapplication = app;
    Dtoolbar    = toolbar;
    Dcontroller  = controller;
    DviewID      = viewID;

    if (!SugarBee.addMailButtonCreated && viewID.indexOf(ZmId.VIEW_COMPOSE) >= 0){
        this._createMailButton(toolbar,controller);
    }

    else if (!SugarBee.addContactButtonCreated && viewID == ZmId.VIEW_CONTACT){
        this._createContactButton(toolbar,controller);
    }
};

SugarBee.prototype._createMailButton = function (toolbar,controller){

    var args = {
        text    : "Envoi+copie sugar",
        tooltip : "Envoi l'e-mail et cr&eacute;e une copie dans SugarCRM",
        image  : "plus",
        index  : 1
    };
   
    var bouton = toolbar.createOp("SugarBeeAddMail",args);
    toolbar.addOp("SugarBeeAddMail",1);
    bouton.addSelectionListener(new AjxListener(this._displayMessage,controller));
    SugarBee.addMailbuttonCreated = true;
};

// The debug (D) ev global variable, will be set right below
Dev = null;
Dcontroller2 = null;
SugarBee.prototype._displayMessage = function(controller,ev){
    Dev = ev;
    Dcontroller2=controller;
    var mail_content = controller.getMsg().getBodyContent();
    //mail_content = mail_content.replace(/\n/g,"<br/>");
    this.dialog.showInfo("Votre message : <br/>"+ mail_content);

};
   
SugarBee.prototype._createContactButton = function (toolbar,controller){
    console.debug("createContactButton appel&eactue;e");
    var args = {
        text    : "Enreg.+copie sugar",
        tooltip : "Enregistre le contact localement et dans SugarCRM",
        image  : "plus",
        index  : 1
    };

    var bouton = toolbar.createOp("SugarBeeAddContact",args);
    toolbar.addOp("SugarBeeAddContact",1);
    bouton.addSelectionListener(new AjxListener(this._displayContact));
    SugarBee.addContactButtonCreated = true;
   
};
   
SugarBee.prototype._displayContact = function(ev){
    this.dialog.showInfo("Nouveau contact ajouté;.");
};

Zimlet LDAP configuration Settings

$
0
0
Hi,

is there any zimlet or any configuration settings for LDAP feature in zimbra.

Thanks...

Adding a Mail Toolbar Button - problem keeping focus.

$
0
0
Hi guys,

I followed the default guide to add a button to mail toolbar, as follow:

Code:

uspSuporte.prototype.initializeToolbar =
function(app, toolbar, controller, viewId) {

    if (viewId == ZmId.VIEW_CONVLIST || viewId == ZmId.VIEW_TRAD) {
        // get the index of "View" menu so we can display the button after that
        var buttonIndex = 0;
        for (var i = 0; i < toolbar.opList.length; i++) {
                if (toolbar.opList[i] == ZmOperation.VIEW_MENU) {
                        buttonIndex = i + 1;
                        break;
                }
        }

        var buttonParams = {
                text: this.getMessage("buttonName"),
                tooltip: this.getMessage("tooltip"),
                index: buttonIndex,
                image: "suporteIcon"
        };

        // creates the button with an id and params containing the button details
        var button = toolbar.createOp("SUPPORT_BUTTON", buttonParams);
        button.addSelectionListener(new AjxListener(this, this._showForm)); 
    }
};

This work great, until I clicked on the Inbox folder. After that, the button just "turn-off", to work again I have to reload zimbra. How I can fix it?

Myportal for Zimbra

$
0
0
I'm having problems trying to find a zimlet for Zimbra. Myportal for Zimbra which intergates Zimbra with our telephone system. If any one shed some light on this it would be much appreciated.

Thanks

Macca

Developer License?

$
0
0
Hi all,

I know that we can get a 60-day trial for the Network Edition. However, I will be doing development on the Webmail client via zimlets, custom skin, etc and was wondering if someone could point me in the right direction as to how I can go about acquiring a developer license for my local installation - thinking 7.14 on Ubuntu 10.04 on a VM?

Thanks,

Paolo

S/mime zimlet

$
0
0
hi, just made a fresh install in test environnement Zimbra 8.0 GA NE and i can't manage to have the s/mime zimlet to work.
The S/Mime button does not appear in the compose page.

- zimlet is active for that user
- s/mime is active in COS

com_zimbra_local

$
0
0
Where can I get this zimlet from? I have two side by side installs, when upgrading to 8.0 GA one gave me issues with the zimlets (when user logs in throws errors0. So, I did as some of the post recommended, removed zimlets and reinstalled, but now I can't find that one file (com_zimbra_local.zip)!

Zimlet Tab with a close button

$
0
0
Hi,

I am new to Zimlets. I am trying to create a zimlet which works as:
- In an email body, when the user hovers on a URL, a pop-up window is created which gives a preview of the URL.
- When the user clicks on the URL, the page is loaded within an iframe, in a new tab.

I need to have a close functionality on the new tab (as in 'New message'/'Compose' tab).

I am able to do it as a 2-stage operation : 1) Delete the button 2) Pop out the current view.

I think there can be an elegant solution to do this. Can anybody help me with this?

Thanks,
Toby

Social compatible with ZCS NE 8.0.x

$
0
0
Is the Social Zimlet ZCS NE 8.0.x compatible?

Google Translator and ZCS 8

$
0
0
Hi there,

Anyone have adopted Google Translator zimlet to work with ZCS 8 ? Any guide to try myself ?

Zimbra LDAP + Samba multiple domains?

$
0
0
Hi I'm wondering if Zimbra LDAP and the zimlets required for managing a samba domain can handle multiple domains. Since Zimbra can handle multiple domains as a mail server, why wouldn't it be able to handle multiple domains for samba authentication? The real question is whether anyone knows how to configure it for multiple domains? I'm new to LDAP so be gentle. I'd say the following page is my only real source of info:

UNIX and Windows Accounts in Zimbra LDAP and Zimbra Admin UI

Thanks in advance!
Viewing all 171 articles
Browse latest View live




Latest Images