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 Display Modes
  #1 (permalink)  
Old 10-13-2009, 01:15 AM
Junior Member
 
Posts: 9
Default forward Attachments

How could I forward an attachment to a new email?
I'm able to grab the body and subject, but not attachments.

I tried using zmObject.attachments or zmObject.getInlineAttachments without results (as written in Zimlet cookbook) but it seems I need something else.

I had a look to email2doc but it seems it puts a simply a link to the object attched more than embed the object (clearly it has create a doc, not an email). Or maybe I didn't look in the right way.

Any suggestion?

Best regards,
Leonardo
Reply With Quote
  #2 (permalink)  
Old 10-13-2009, 04:28 AM
Junior Member
 
Posts: 9
Default

In case this can help someone (and someone can help me), this is the snippet I assembled:

Code:
com_zimbra_calls2.prototype.doDrop =				// on Drop do:
function(zmObject) {

	if (!zmObject.srcObj)
		return;

	zmObject = zmObject.srcObj;
	if (zmObject.type == "CONV") {
		zmObject = zmObject.getFirstHotMsg(); 		// if in a CONVersation, grab the last (?) message received
	}



	//get Subject
	var subject = zmObject.subject; 

	//get Body (composing always in html)
	var body = zmObject.getBodyContent().replace(/\r\n|\n/g, "<br>");

	// get Destination emails	
	var to = [];								// to,from,cc,bcc (reply_to, sender ?)
	var participants = zmObject.participants.getArray(); 			// get all email participants 

	for(var i =0; i < participants.length; i++) {
	     if(participants[i].type == AjxEmailAddress.TO) {	// choose which type of participants (TO,FROM,CC,BCC,REPLY_TO,SENDER
		      to.push(participants[i].address);		// add participants to variable (in this case "to")
		    }
	};


// here there should be something for Attachments
// var attaArray =  zmObject.attachments;


//	debug lines
//	alert ( "body: " + body); ....

	var composeController = AjxDispatcher.run("GetComposeController");    // create email
		if(composeController) { 
			Compose_Mail_Example.count = Compose_Mail_Example.count + 1;    // this is just to count the number of tests
			body = body + "<br> test number: " + Compose_Mail_Example.count;
			var newWindow = false;

//			var to = "aaaa@bbbb.com";					// just as example

			var params = {action:ZmOperation.NEW_MESSAGE, inNewWindow:newWindow, 
			toOverride:to, subjOverride:subject, extraBodyText:body, callback:null, composeMode:DwtHtmlEditor.HTML}
			composeController.doAction(params); // opens asynchronously the window, composing in HTML
		}





};

Last edited by leocor : 10-13-2009 at 07:11 AM.
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