<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I made a note of this on MDN:<br>
<br>
<a class="moz-txt-link-freetext" href="https://developer.mozilla.org/en/Extensions/Thunderbird/HowTos/Common_Thunderbird_Use_Cases/View_Message#Get_MIME_Header_for_any_message">https://developer.mozilla.org/en/Extensions/Thunderbird/HowTos/Common_Thunderbird_Use_Cases/View_Message#Get_MIME_Header_for_any_message</a><br>
<br>
Thanks protz!<br>
<br>
<br>
jen.<br>
<br>
On 11-11-10 1:26 AM, Jonathan Protzenko wrote:
<blockquote cite="mid:4EBB98DB.1040107@gmail.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Hi all,<br>
<br>
I'm posting this here in the hope that it's useful to other addon
developers, and that it shows up in search results.<br>
<br>
Recently (Thunderbird 10), David Bienvenu kindly implemented a new
function that allows one to quickly grab the headers part of a
given message body. This is very useful: if the message has
attachments, we won't be downloading the entire body just to get
the headers.<br>
<br>
I wrote a function on top of that that does the dirty work to <b>get
the MIME headers of an email</b> in Thunderbird. It provides a
nice API on top of David's function, and is also able to work with
older versions of Thunderbird.<br>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://github.com/protz/thunderbird-stdlib/blob/master/msgHdrUtils.js#L428">https://github.com/protz/thunderbird-stdlib/blob/master/msgHdrUtils.js#L428</a><br>
<br>
(I'm not copy/pasting the whole code here because there's a stream
listener involved and some other stuff. As usual, you can grab my
thunderbird-stdlib project to use the function right away.)<br>
<br>
<b>Here's how you use it:</b><br>
<br>
<blockquote><tt>msgHdrGetHeaders(gFolderDisplay.selectedMessage,
function (aHeaders) {</tt><br>
<tt> if (aHeaders.has("reply-to"))</tt><br>
<tt> dump("This message has a reply-to header; its value is
"+aHeaders.get("reply-to")+"\n");</tt><br>
<tt>});</tt><br>
</blockquote>
<br>
This allows you to get the headers of any message (not just the
one that's displayed, like in the example). It's particularly
useful when you have an nsIMsgDBHdr, and you want to inspect it.<br>
<br>
Let me know if you have any suggestions / bug reports / ideas :)<br>
<br>
Cheers,<br>
<br>
jonathan<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
tb-planning mailing list
<a class="moz-txt-link-abbreviated" href="mailto:tb-planning@mozilla.org">tb-planning@mozilla.org</a>
<a class="moz-txt-link-freetext" href="https://mail.mozilla.org/listinfo/tb-planning">https://mail.mozilla.org/listinfo/tb-planning</a>
</pre>
</blockquote>
<br>
</body>
</html>