<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
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 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>
</body>
</html>