Results 1 to 2 of 2

Thread: Extra Mime Parts?

  1. #1
    Join Date
    Mar 2006
    Posts
    21
    Rep Power
    9

    Default Extra Mime Parts?

    Hey Guys,

    I was playing around with modifying the message via my Zimlet javascript. My goal was to append some additional html or text onto the message that would normally be hidden to the user (so they can't modify it). Here's the code that I used:

    var videoHolder = new ZmMimePart();
    videoHolder.setContentType(ZmMimeTable.TEXT_HTML);
    videoHolder.setContent("<h3>This would be my video rider</h3>");
    var videoText = new ZmMimePart();
    videoText.setContentType(ZmMimeTable.TEXT_PLAIN);
    videoText.setContent("Plain Text Video Description");

    composerView.addMimePart(videoText);
    composerView.addMimePart(videoHolder);

    The code worked, in a way. When I triggered this code and sent off the message, the original message was 'lost'. All that would be visible was the extra mime part that I added (either one depending on my client's view preference, so both html and plain types were visible in the same message).

    Did I do something wrong or is there a bug in the code? My assumption is that extra mime parts would not override the original message. BTW, when I say original message I mean the message that the user was composing, not one that they would be replying to.

    Cheers,
    Marty

  2. #2
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    19

    Default

    Well here's the logic:

    Code:
    	// set up message parts as necessary
    	var top = new ZmMimePart();
    
    	if (this._composeMode == DwtHtmlEditor.HTML) {
    		top.setContentType(ZmMimeTable.MULTI_ALT);
    
    		// create two more mp's for text and html content types
    		var textPart = new ZmMimePart();
    		textPart.setContentType(ZmMimeTable.TEXT_PLAIN);
    		textPart.setContent(this._htmlEditor.getTextVersion());
    		top.children.add(textPart);
    
    		var htmlPart = new ZmMimePart();
    		htmlPart.setContentType(ZmMimeTable.TEXT_HTML);
    		htmlPart.setContent(this._htmlEditor.getContent());
    		top.children.add(htmlPart);
    	} else {
    		var textPart = this._extraParts ? new ZmMimePart() : top;
    		textPart.setContentType(ZmMimeTable.TEXT_PLAIN);
    		textPart.setContent(this._htmlEditor.getContent());
    
    		if (this._extraParts) {
    			top.setContentType(ZmMimeTable.MULTI_ALT);
    			top.children.add(textPart);
    		}
    	}
    
    	// add extra message parts
    	if (this._extraParts) {
    		for (var i = 0; i < this._extraParts.length; i++) {
    			var mimePart = this._extraParts[i];
    			top.children.add(mimePart);
    		}
    	}
    Did you try this both in HTML compose mode and test compose mode? Seems the logic is a bit different for the two cases.

    What I'd recommend is you do your test with Venkman (JS debugger for Firefox) and try to figure out exactly at which point the extra parts overwrite the main message. From a quick inspection the code looks right.
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

Similar Threads

  1. Replies: 1
    Last Post: 06-29-2007, 09:53 AM
  2. Network Service Error with MIME encoded message
    By Glenham in forum Administrators
    Replies: 2
    Last Post: 10-17-2006, 10:37 AM
  3. extra modules loaded: Net/LDAP/Bind.pm
    By vpsadmin@webindia.com in forum Users
    Replies: 1
    Last Post: 08-05-2006, 12:29 PM
  4. Replies: 1
    Last Post: 05-16-2006, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •