View Single Post
  #2 (permalink)  
Old 10-13-2009, 04:28 AM
leocor leocor is offline
Intermediate Member
 
Posts: 22
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