Handle info from Thunderbird wizard to a new compose mail window
I've just started (a week ago) a new plug-in development for Thunderbird, and I've a question I didn't find the answer on the web.

I made a wizard (with checkboxes, radio, textboxes, etc.), and I'd like to open a new compose window with the answered elements. I managed to open a window using this code:

    function envoi_mail(id) {
        var sURL="mailto:test@test.com?subject=test";  
          
          var msgComposeService=  
            Components.classes["@mozilla.org/messengercompose;1"]  
            .getService(Components.interfaces.nsIMsgComposeService);  
          
          // make the URI  
          var ioService =  
            Components.classes["@mozilla.org/network/io-service;1"]  
              .getService(Components.interfaces.nsIIOService);  
          
          aURI = ioService.newURI(sURL, null, null);  
          
          // open new message  
          nouveau_mail = msgComposeService.OpenComposeWindowWithURI (null, aURI); 
    	  
     
    	return true;
    }

But I can't find how to modify the body. I found some "solutions" like this one:
https://developer.mozilla.org/en/Extensions/Thunderbird/HowTos/Common_Thunderbird_Use_Cases/Compose_New_Message
However, I really don't understand how I can insert this in my javascript. I managed to display an alert box by adding this line at the end of my javascript:

     window.addEventListener( "compose-window-init", prep_mail(), true ); 

The "prep_mail" function is defined like this:

    function prep_mail() {
    	alert('prep_mail');
    	gMsgCompose.RegisterStateListener(myStateListener);
    	alert('prep_mail2');
    }

I only see the "prep_mail" alert, not the second one.

Does anybody have a solution?
Thanks a lot

Cesar
Handle info from Thunderbird wizard to a new compose mail window
===

I've just started (a week ago) a new plug-in development for Thunderbird, and I've a question I didn't find the answer on the web.

I made a wizard (with checkboxes, radio, textboxes, etc.), and I'd like to open a new compose window with the answered elements. I managed to open a window using this code:

    function envoi_mail(id) {
        var sURL="mailto:test@test.com?subject=test";  
          
          var msgComposeService=  
            Components.classes["@mozilla.org/messengercompose;1"]  
            .getService(Components.interfaces.nsIMsgComposeService);  
          
          // make the URI  
          var ioService =  
            Components.classes["@mozilla.org/network/io-service;1"]  
              .getService(Components.interfaces.nsIIOService);  
          
          aURI = ioService.newURI(sURL, null, null);  
          
          // open new message  
          nouveau_mail = msgComposeService.OpenComposeWindowWithURI (null, aURI); 
    	  
     
    	return true;
    }

But I can't find how to modify the body. I found some "solutions" like this one:
https://developer.mozilla.org/en/Extensions/Thunderbird/HowTos/Common_Thunderbird_Use_Cases/Compose_New_Message
However, I really don't understand how I can insert this in my javascript. I managed to display an alert box by adding this line at the end of my javascript:

     window.addEventListener( "compose-window-init", prep_mail(), true ); 

The "prep_mail" function is defined like this:

    function prep_mail() {
    	alert('prep_mail');
    	gMsgCompose.RegisterStateListener(myStateListener);
    	alert('prep_mail2');
    }

I only see the "prep_mail" alert, not the second one.

Does anybody have a solution?
Thanks a lot

Cesar