Thunderbird extensions by cweiske


Table of Contents

Preface
1. dispMUA: Display Mail User Agent
Requirements
Functionality
How it's done
User overrides
Get it
2. mailinglistheader
Requirements
How it works
Get it
3. Display mail route
Requirements
Customization
Get it

List of Examples

1.1. Sample override file

Preface

This document desribes some of the Mozilla Thunderbird extensions written by Christian Weiske.

I wrote these extensions for my personal enjoyment and curiosity, but made them public to give something back to the "community" - I use an uncountable number of free software, and I want to give something back.

But even if I don't charge anything for the software, I ask you to send me an e-mail telling me that you like my work. Or, even better, send me a postcard from your part of the world - your city, a well known or not so well known monument/place/... near your location or whatever crosses your mind. If you want to do this, send the postcard to:

Christian Weiske
Dorfstrasse 42
04683 Threna
Germany

If you want to translate one of the extensions into your language, contact me.

Chapter 1. dispMUA: Display Mail User Agent

dispMUA, short for "Display Mail User Agent", is an extension for Mozilla Thunderbird.

Its sole purpose is to display an icon at the right part of the message header view, matching the mail program (user agent) whith which the current selected mail has been written.

So if you select a mail written with Eudora, there would be an euroda icon right of the Subject/From/Date fields - but only if the "expanded header view" is activated. It is activated if there is a minus sign before the "Subject" field.

Beside the included icons, you can add your own icons for special header lines. See the "user overrides" section.

Requirements

You need to install Mnenhy or Enigmail to get dispMUA fully working. You don't need to do it, but some user agents might not get recognized.

Functionality

Apart from displaying an icon for the user agent, you can hover the icon to see the exact user agent line. If you click on the icon, you will see the icon in a message box.

If there is a mail written by an user agent for which dispMUA has no icon, a symbol with a question mark is shown. Click on it, and a "new mail" window will open, containing my address in the From field and the exact user agent line in the mail body. Send it to me, so that I get notified about it.

How it's done

When a new message is selected, the headers of the mail are searched for lines beginning with "User-Agent", "X-Mailer" and such. This lines are compared with a big list of line-to-icon assignments, and the matching icon is displayed.

By default, an extension can access only a small part of the mail's headers (subject, from, to, user-agent). Now some user agents use "X-Mailer" or some really weird header lines to identify themselves - this lines don't get to the extension, as they're not in the default header list.

It is very difficult to modify the header list but prevent the headers in the list to show in the GUI. The extensions Mnenhy and Enigmail already did this, but writing a new extension which does the same and doesn't collide with the other ones requires changes to not only the new extension, but the other ones as well. That's why I decided to let Mnenhy or Enigmail do the part - and so you have to install one of them to get all emails identified correclty.

User overrides

Although the list of supported user agents is rather long (over 200 icons), the mail will come which causes dispMUA to display a question mark - unsupported user agent. You can send the header to me by clicking on the icon, but as I don't really have time to search for icons all day, it may take a long time until the new user agent is supported.

Another scenario is that you work as a web developer and let mails from different web pages identify themselves with an "X-Mailer:" or "User-Agent" header line, and want to have different icons for them. It wouldn't make sense to send the headers to me as there are not many people which would ever see this mail, and dispMUA would only get bloated with this icons.

The solution for this problems are "user overrides": A list with headers and the corresponding icons which you can define.

First, you need to create a file called dispMuaOverlay.csv in your thunderbird profile directory (On *nix, it is at ~/.thunderbird/<profilename>/, on Windows it should be at C:\Documents and Settings\<username>\Application Data\Thunderbird\Profiles\<profilename>\).

In the file itself, you write the header-icon-association on one line each; the first part is the (part of the) lowercase header line, then a comma, and then the path to the icon. It's a semi-csv format, so you divide the two parts by a comma, but can use quotes around the fields if you have a comma in the header or path itself.

The path to the icon has to be a full URL, e.g. "http://example.com/icon.png" or "file:///home/cweiske/icons/test.png" (Linux) or "file:///C:/icons/icon.png" (Windows).

Example 1.1. Sample override file

thunderbird,file:///data/grafik/mytbicon.png
exampleagent,http://example.com/icons/agent.gif
"agent,with,comma",http://example.com/icons/commaagent.png

The override file is loaded once when thunderbird is started. Changes to the file are not reflected as long as thunderbird is running - you have to restart to see the changes in action.

After the message has been selected and the headers have been parsed by dispMUA, it firstly looks in the user override list, and compares the lowercased lines with the ones from the list. If the agent from the override is part of the mail header line, the symbol is taken. If not, the next override line is tested. If no user override matches, the normal icons are tried.

This method has the following consequences for you:

  • Always write lowercased agent lines in the override file. If the mail identifies the agent with "My Cool MailingAgent", you have to could use "cool mailingagent" (part of the agent header line), but not "MailingAgent", as the uppercase letters will never match.

  • You can override existing icons with your own ones. If the WinBiff icon doesn't meet your style criteria, you can replace it with your own one.

  • Take care of the order. If line 2 matches all agents with "under" in their name, the icon will always be preferred over the one in line 10, the icon for e.g. "thunderbird".

Get it

The dispMUA homepage is at http://www.cweiske.de/misc_extensions.htm#dispMUA.

Chapter 2. mailinglistheader

The mailinglistheader extension extends the expanded header view with a new line, displaying special links for mailing list mails.

Most mails distributed over mailing lists contain special headers like "list-help", "list-unsubscribe" and such. For a complete list, see RFC 2369.

You can click the links, which will open a new mail (e.g. for the "post" or "unsubscribe" commands), or may open the browser, if it's a http link.

Requirements

Mnenhy or Enigmail. See the dispMUA requirements for details about it. This time they are required, as none of the list headers are in the default header list.

How it works

The same way as dispMUA, but this time the extension looks for the headers defined in RFC 2369.

Get it

The mailinglistheader extension can be found at http://www.cweiske.de/misc_extensions.htm#mailinglistheader.

Chapter 3. Display mail route

This one is as useless as dispMUA, but nice to see: It displays the way the selected mail took in the internet in a graphical way. Specifically, this is done by scanning the "Received" headers of the mail, searching them for domain names and displaying the country flags of them. So if the mail went from lists.php.net over example.co.uk to cweiske.de, a network symbol, the British flag and the German flag would be displayed.

It is really fun to walk through your mails and see from where and over which stations (relays, gateways) the mail has been sent. That way I got aware of countries I never thought they'd exist or that actually people from there would write to me. The company I work for, netresearch, internally uses .nr as Top Level Domain for development domains. One day I saw the route of the mails: Germany, Nauru, Germany and Germany - that was because the internal mail server has a .nr domain and was recognized as located in Nauru. I had a good laughter :)

Beside the route, the extension displays a large flag for the country the mail came from (From: domain) at the right side of the expanded header view, just as dispMUA does it.

Requirements

As always: Mnenhy or Enigmail. See the dispMUA requirements for details about it.

Customization

This is the first of my extensions which allows the user to control the behavior. Edit the prefs.js file in your profile folder and add one or more of the following values:

mail.mailRoute.hideRoute

If set to true, the route flags are hidden. Because the route is most fun to see, I don't recommend that you deactivate it :) Default is false.

mail.mailRoute.hideFrom

Hides the large From: country flag at the right side of the expanded header view. Default is false.

mail.mailRoute.routeIconSize

Set the width and height of the route flags in pixels, default is 24. (Only one number as the flag pictures are square)

mail.mailRoute.ownIconDir

Set the directory if your own country and domain icons. Examples would be file://localhost/data/grafik/ on Linux or file:///C:/icons/ on Windows. If this directory is set, each time the route is displayed, the directory is searched for .png files matching the domain name. For example, if the flag of the domain "mail.server.example.com" is requested, the following filenames are tried: mail.server.example.com.png, then server.example.com.png, after that example.com.png and at last com.png. If even that doesn't exist, the original icon shipped with mail route is used. Don't worry about performance, the results of the search is cached - if the file doesn't exist, it isn't requested a second time to save CPU cycles.

mail.mailRoute.cacheIcons

This is set to true by default, enabling caching of the file existance checks for the own icons. You want to disable it if you want to add own icons to the icons directory while having Thunderbird open for browsing the routes.

Get it

The display mail route extension can be found at http://cweiske.de/misc_extensions.htm#mailRoute.