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-18-2009, 05:12 PM
Member
 
Posts: 12
Default Cannot get from address into dragSource

Here is a Zimlet that is supposed to do a Yahoo search on the From: address of an email that is dragged onto it:
Code:
<zimlet name="com_mydomain_test" version="1.0" description="Our Test Zimlet">
  <zimletPanelItem label="Yahoo Lookup Zimlet">
    <toolTipText>
      This Zimlet does a Yahoo lookup on an email address.
    </toolTipText>
    <dragSource type="ZmMailMsg">
      <canvas type="window" width="400" height="400" />
      <actionUrl method="get" target="http://search.yahoo.com/search">
        <param name="p">${obj.from}</param>
      </actionUrl>
    </dragSource>
  </zimletPanelItem>
</zimlet>
It does not work: the search that results is for the string "undefined". If I change "{$obj.from}" to "{$obj.subject}" I get a search on the email's subject; if I use ${obj.convId}" I get the correct conversation id. It only seems to fail with the from. The "to" attribute also fails.

I checked the emails and they have From: headers of the form "From: John Public <jqpublic@mydomain.com>".

Of the ones I tried, here are the ones that work
  • subject
  • date
  • id
  • convId
  • size

and the ones that do not work (return "undefined"):
  • from
  • to
Reply With Quote
  #2 (permalink)  
Old 01-18-2009, 08:32 PM
Zimbra Employee
 
Posts: 187
Default

thats because with in Zimbra, "from" is not a string, but an object with email, firstname, fullname etc properties. And unfortunately writing zimlets via xml has some limitation and doesnt do things like toString() or allow little more complex things to get the information needed.

The good news is you can however write up a small javascript to get the same thing done.
Code:
com_mydomain_test.prototype.doDrop =
function(zmObject) {
	var from = "";
     if(zmObject.from) {
          from = zmObject.from[0];
     } else if(zmObject.participants) {//if conversation..
	//get the first sender
	var p = zmObject.participants;
	for(var i =0; i < p.length; i++) {
		if(p[i].type == "FROM") {
			from = p[i].address;
			break;
		}			
	}
     }

	
     window.open("http://search.yahoo.com/search?p="+from);
 };
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #3 (permalink)  
Old 02-19-2010, 01:45 PM
Zimbra Employee
 
Posts: 105
Default

This is an older thread but posting this additional information for reference.

This zimlet has an example of retrieving the from/to/cc addresses from a ZmMailMsg. This zimlet was written for ZCS 6.0:

ZCS 6.0:Zimlet Developers Guide:Examples:Panel Item Drag Source Details - Zimbra :: Wiki
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.