How to copy a list of message headers to the clipboard.

User Help for Mozilla Thunderbird
Posts: 5
Joined: March 30th, 2018, 9:51 am

Post Posted April 5th, 2018, 7:57 pm

Does anyone know to print a list of Message Headers in a local message folder?

I have a local folder with very many messages and I would like to copy a list of just the message headers to the clipboard. Or at least print the list.

Thunderbird allows me to 'Select All' the message headers but anything you want to do with that selection deals with each message individually. I don't want to print, or copy all the message contents, I just want to print, or copy the message headers.

All suggestions or advice would be appreciate. Especially if I can copy a list of headers to the clipboard and then get that into MS Excel to deal with it...

Many thanks in advance.


User avatar
Posts: 45109
Joined: July 30th, 2003, 5:06 pm

Post Posted April 5th, 2018, 9:51 pm

The ImportExportTools add-on at ... porttools/ supports exporting a HTML copy of the folder listing using tools -> importexporttools -> export all messages in folder -> "just index" . "just index (csv)" would create a .csv file if you want to import it into Excel.

Posts: 3142
Joined: February 3rd, 2009, 6:29 pm

Post Posted April 9th, 2018, 8:31 pm

I noticed the ColumnsWizard extension doesn't work with the ImportExportTools extension.


Example: viewtopic.php?f=39&t=3038928

Here is how to copy a list with extra message headers (e.g. reply-to and message-id) to the clipboard.


* select folder(s) in 3pane window
* open config editor in options
* set preference to true
* open error console in developer tools
* copy and paste code into error console
* press enter to run
* open example tab
* focus page, select all, copy
* open excel
* paste

Select multiple folders grouped together:

* press and hold shift key, click first folder, click last folder

Select multiple folders that are not grouped together:

* press and hold ctrl key, click first folder, click second folder, click third folder

Code: Select all
function encodeHTML(s) {
  var converter = Components.classes[""].
  converter.charset = "UTF-8";
  s = converter.ConvertFromUnicode(s);
  s = s.replace(/&/g, "&");
  s = s.replace(/>/g, ">");
  s = s.replace(/</g, "&lt;");
  s = s.replace(/"/g, "&quot;");
  s = s.replace(/'/g, "&apos;");
  if (!s) s = "&nbsp;";
  return s;
var out = [];
out.push('<table width="99%" border="1">');
var folders = GetSelectedMsgFolders();
for (var i = 0; i < folders.length; i++) {
  var enumerator = folders[i].messages;
  while (enumerator.hasMoreElements()) {
    var hdr = enumerator.getNext().
    var date = new Date(hdr.dateInSeconds * 1000).toLocaleString();
    out.push("<td>" + encodeHTML(                     + "</td>"); // Folder
    out.push("<td>" + encodeHTML(hdr.mime2DecodedSubject)             + "</td>"); // Subject
    out.push("<td>" + encodeHTML(hdr.mime2DecodedAuthor)              + "</td>"); // From
    out.push("<td>" + encodeHTML(hdr.mime2DecodedRecipients)          + "</td>"); // To
    out.push("<td>" + encodeHTML(date)                                + "</td>"); // Date
    out.push("<td>" + encodeHTML(hdr.getStringProperty("replyTo"))    + "</td>"); // Reply-To
    out.push("<td>" + encodeHTML(hdr.getStringProperty("message-id")) + "</td>"); // Message-ID
var data = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">';
data += "<html><head><title>Example</title>";
data += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
data += "</head><body>" + out.join("\n") + "</body></html>";
var win = Components.classes[";1"].
win.document.getElementById("tabmail").openTab("contentTab", {
  contentPage: "data:text/html;charset=utf-8;base64," + btoa(data),
  background: true,

Table columns in example: Folder, Subject, From, To, Date, Reply-To, Message-ID

The code is not dependent on ColumnsWizard or ImportExportTools. (no need to install those extensions)

Error Console command line

Similar thread: viewtopic.php?f=19&t=3040867

Return to Thunderbird Support

Who is online

Users browsing this forum: Bing [Bot] and 6 guests