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

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 Display Modes
  #1 (permalink)  
Old 05-14-2009, 11:31 PM
Project Contributor
 
Posts: 250
Default Zimbra ActionScript Library Release

Hello guys,

So here is the first public release of the Zimbra ActionScript library.

It has the ability to create, edit, remove, etc. folders, tags, emails, conversations and searches.

Be sure to check it out and let me know what you think!

Zimbra Mail ActionScript Library | funciton communications - blog

Thanks!
Reply With Quote
  #2 (permalink)  
Old 05-26-2009, 05:30 PM
Starter Member
 
Posts: 1
Default Do you have any unit tests / examples to get me started ?

Fernando,
I recently came across your Zimbra Mail actionscript library and it seems just perfect for my needs (implement functionality in flex instead of Zimlets). Do you have any unit tests / examples to get me started ?

cheers...
Reply With Quote
  #3 (permalink)  
Old 05-26-2009, 11:06 PM
Project Contributor
 
Posts: 250
Default

I'll upload the unit tests on the weekend.

It's very simple to use actually, for example:

Code:
import inca.api.Zimbra;
import inca.api.events.

var zimbra:Zimbra = new Zimbra();
zimbra.secureConnection = true; //https
zimbra.server = "mail.domain.com";
zimbra.username = "username@domain.com";
zimbra.password = "XXX";
zimbra.addEventListener(ZimbraEvent.LOGGED_IN, onLoggedIn, false, 0, true);
function onLoggedIn(e:ZimbraEvent):void{
trace ("LOGGED IN!");
}
zimbra.login();
Thats the basic thing. Now, lets try an "inbox" search.

Change the "onLoggedIn" event handler:

Code:
function onLoggedIn(e:ZimbraEvent):void{
(e.target as Zimbra).addEventListener(ZimbraSearchEvent.COMPLETE, onSearchComplete, false, 0, true);
(e.target as Zimbra).search("in:inbox");
}

function onSearchComplete(e:ZimbraSearchEvent):void{
// get all email returned by the search
trace ((e.data as ZimbraSearchResponse).collection);
}
I'll post a new example tomorrow.

Thanks for using it

Cheers!
Reply With Quote
  #4 (permalink)  
Old 05-31-2009, 07:25 PM
Project Contributor
 
Posts: 250
Default

Here is another example i wrote quickly for Adobe Air:

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication 
	xmlns:mx="http://www.adobe.com/2006/mxml" 
	layout="absolute"
	applicationComplete="init();">
	
	<mx:Script>
		<![CDATA[
			
			import inca.api.Zimbra;
			import inca.api.events.*;
			import inca.api.models.*;
			
			private var $__zimbra:Zimbra = new Zimbra();
			private var $__zimbraMessage:ZimbraMessage;
			
			private function init():void{
				$__zimbra.server = "mail.domain.com";
				$__zimbra.username = "user@domain.com";
				$__zimbra.password = "myPassword";
				$__zimbra.addEventListener(ZimbraEvent.LOGGED_IN, onLoggedIn, false, 0, true);
				
				$__zimbra.login();
			}
			
			private function onLoggedIn(e:ZimbraEvent):void{
				(e.target as Zimbra).addEventListener(ZimbraSearchEvent.COMPLETE, onSearchComplete);
				
				(e.target as Zimbra).search("in:inbox", Zimbra.LIST_TYPE_MESSAGE, 1);
			}
			
			private function onSearchComplete(e:ZimbraSearchEvent):void{
				var messages:Array = (e.data as ZimbraSearchResponse).collection;
				
				$__zimbraMessage = $__zimbra.getMessage(messages[0].id);
				$__zimbraMessage.addEventListener(ZimbraEvent.MESSAGE_LOADED, onMessageLoaded);
			}
			
			private function onMessageLoaded(e:Event):void{
				var msg:ZimbraMessage = (e.target as ZimbraMessage);
				
				trace ("subject:", msg.subject, "\nmessage:", msg.content);
			}
			
			
		]]>
	</mx:Script>
	
</mx:WindowedApplication>
I didn't include try..catch blocks so if your search returns zero messages an error will be thrown.

Oh! BTW, i updated the library today to fix a bug on the folder listing.

Hope to have some free time this week to release the calendar part of the library.

Cheers!
Reply With Quote
  #5 (permalink)  
Old 05-31-2009, 11:55 PM
Project Contributor
 
Posts: 250
Default

I would love to see if you guys like how the library is implemented.

Do you guys think it would be a good idea to translate it to maybe javascript?

It is very lightweight compared to Zimbra's.

Cheers!
Reply With Quote
Reply


Thread Tools
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.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0