Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: ZmMailMsg

  1. #1
    jfavero is offline Project Contributor
    Join Date
    Jan 2007
    Posts
    31
    Rep Power
    8

    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

  2. #2
    KevinH's Avatar
    KevinH is offline Expert Member
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    18

    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.
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

  3. #3
    pshah is offline Zimbra Employee
    Join Date
    Sep 2005
    Location
    Sunnyvale, CA
    Posts
    269
    Rep Power
    9

    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!

  4. #4
    jfavero is offline Project Contributor
    Join Date
    Jan 2007
    Posts
    31
    Rep Power
    8

    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();
    };

  5. #5
    jfavero is offline Project Contributor
    Join Date
    Jan 2007
    Posts
    31
    Rep Power
    8

    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.

  6. #6
    jfavero is offline Project Contributor
    Join Date
    Jan 2007
    Posts
    31
    Rep Power
    8

    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

  7. #7
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    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

  8. #8
    jfavero is offline Project Contributor
    Join Date
    Jan 2007
    Posts
    31
    Rep Power
    8

    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

  9. #9
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    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

  10. #10
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    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

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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