Morten Poulsen wrote:
> 
> Hi,
> 
> I get a lot of spam, so I am working on a 'report spam' button, which
> should post the source of a mail to spamcop.net.
> 
> My problem is: How do I get the source of a message? In ViewPageSource()
> in mailnews/base/resources/content/mailCommands.js an URL is made and
> passed to window.openDialog(), and in SaveAsFile(), the messenger object
> is told to save the message as a file.
> 
> Is it possible to get the source of a message as a string?

If you have a document object representing the mail window,

function getMessageBrowser()
{
  if (!gMessageBrowser)
    gMessageBrowser = document.getElementById("messagepane");

  return gMessageBrowser;
}

    var messagepane = getMessageBrowser();
    if (messagepane) {
        var message = messagepane.docShell.contentViewer.DOMDocument;  

Then, you can serialise the message object in some way (call toString()
?) to get the message as a string.

Gerv

Reply via email to