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-30-2007, 02:00 PM
Project Contributor
 
Posts: 31
Default ZmMailMsg

I have a zimlet javascript that is processing
a ZmConv when I drop an email onto my zimlet.

The problem I am having is how do I get a ZmMailMsg
from the ZmConv?? I want to have access to the
attachments and the mime mail message.

In my javascript I tried:

var msg = new ZmMailMsg(this._appCtxt, conv.id);

conv.id is the msgId from the ZmConv.

This did not yield the ZmMailMsg. I have done a checkout from
SVN to look at examples, however nothing is registering. Any help
would be appreciated.

Thanx Joe
Reply With Quote
  #2 (permalink)  
Old 01-30-2007, 09:16 PM
Zimbra Employee
 
Posts: 4,792
Default

http://zimbra.svn.sourceforge.net/vi...odel/ZmConv.js

ZmConv has a load method to load the messages in it. Then use ZmConv.prototype.getFirstMsg to get the First. See that code to find the internal vars that hold the rest of the messages.
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #3 (permalink)  
Old 01-30-2007, 09:23 PM
Zimbra Employee
 
Posts: 269
Default

Joe,

Try checking out the Google Translator zimlet. It works by dragging a conversation onto the zimlet which then grabs the first message from the conversation and sends the contents to the translator.

Sounds like this will help move you along.
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #4 (permalink)  
Old 01-30-2007, 10:15 PM
Project Contributor
 
Posts: 31
Default

I must be an idiot, but none of these responses make sense!!!

Here is the doDrop() code from the G Translator. Where is
the Mail message being extracted???

Can someone just sent me an example instead of just throwing ideas around the do not make sense?? I just want to get the Mail message out so I can pull out the attachments!!

Com_Zimbra_Gtranslator.prototype.doDrop =
function(zmObject) {
this._zmObject = zmObject;
this._isUserInput = false;

// create a dialog if one does not already exist
if (!this._gTranslatorDialog) {
this._initialize();
}

// reset widgets
this._contentDIV.innerHTML = AjxStringUtil.nl2br(this._zmObject.body);
this._contentTA.style.visibility = "hidden";
this._contentDIV.style.visibility = "visible";

// reset widgets so user can read translated text
this._langSelect.setSelected(0);

this._gTranslatorDialog.popup();
};
Reply With Quote
  #5 (permalink)  
Old 01-30-2007, 10:19 PM
Project Contributor
 
Posts: 31
Default

Again,

From My javascript file, how do I call

ZmConv.prototype._loadMsgs =
function(convNode) {
// for all messages in this conversation,
var childNodes = convNode.childNodes;
var len = childNodes.length;
for (var i = 0; i < len; i++) {
if (childNodes[i].nodeName == "m")
this.msgs.addFromDom(childNodes[i]);
}
};

What do I pass in as a convNode??

An Javascript sample of getting the ZmMailMsg from a ZmConv would be nice.
Reply With Quote
  #6 (permalink)  
Old 01-31-2007, 02:03 PM
Project Contributor
 
Posts: 31
Default

Here is my Javascript being called when a ZmConv is dropped on my Zimlet.

Com_Xythos_XythosZimlet.prototype.noteDropped = function(note) {

this.login();

DBG.println(AjxDebug.DBG1, "Processing Note ...");



// Lets get the Email Message

ZmConv.prototype._loadMsgs(note);

var msg = ZmConv.prototype.getFirstMsg();


When I call the _loadMsgs() ... I get _1608 has no properties Error
Reply With Quote
  #7 (permalink)  
Old 02-08-2007, 09:53 AM
Loyal Member
 
Posts: 97
Default Extracting from

I could not get the ZmConv.prototype.getHotMsg function to work either.
I want to seperate out the from from the conversation messages.
The best way would be if it's a conversation, if the getHotMsg actually worked, use it to get an ID then get the message via id.

I think obj.id returns the same number in both conv or msg, except conv has negative sign in front. -1403 in conv and 1403 in msg. But someone may want to test.

This is how I'm getting around it.

if (obj.TYPE = "ZmMailMsg"){
this.email_from = obj.from;

}
if (obj.TYPE = "ZmConv"){
this.email_from = obj.participants[0];

}
__________________
EricX
Reply With Quote
  #8 (permalink)  
Old 02-15-2007, 09:43 AM
Project Contributor
 
Posts: 31
Default

My main issues is trying to get the ZmMailMsg for the ZmConv object.
What I want is to be able to get to the email attachments and to mime encode and store the entire mail message. I have worked on this for weeks and have not been able to figure this one out.

Joe
Reply With Quote
  #9 (permalink)  
Old 02-15-2007, 10:14 AM
Loyal Member
 
Posts: 97
Default Whole email message

http://wiki.zimbra.com/index.php?title=Zimbra_to_PHP

I've started writing a wiki on just the same thing. I don't know what your target app is but this might be the easiest way. I'd have it curl the whole thing as a .zip file.
__________________
EricX
Reply With Quote
  #10 (permalink)  
Old 02-15-2007, 10:17 AM
Loyal Member
 
Posts: 97
Default Zimlet

Are you trying to make a zimlet, where you drag an email and it prompts to save the email to your hard drive. I bet I could hack one out this weekend. Send me an email if your interested?
__________________
EricX
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


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.