Custom headers

From MozillaZine Knowledge Base
Jump to navigationJump to search
This article was written for Thunderbird but also applies to Mozilla Suite / SeaMonkey (though some menu sequences may differ).

Add custom headers

The mailnews.customHeaders and mail.compose.other.header settings are used to add custom headers. They're supported in all versions. The first one adds headers that can be used in searches while the other one adds headers to the list of header fields such as To, CC etc that you can use when composing a message.

mailnews.customHeaders is a string of custom headers separated by spaces, with each entry except for the last one ending with ':'. For example: X-Spam-hits: Body: Reply-To

mail.compose.other.header is a string of custom headers separated by commas. For example, X-No-Archive,X-gazette-tag

You could select X-No-Archive and type "yes" (without the quotes) when composing the message to add a X-No-Archive: yes header.

You can add custom headers by editing prefs.js (not recommended), using the Config Editor or by using the "customize..." option at the bottom of the leftmost list box in searches and message filters to add a custom header (it updates mailnews.customHeaders).

Thunderbird 1.5 added the ability to add a custom header to every message you send using a identity (From: address), without having to do anything when composing the message. It requires at least two preferences be added to prefs.js. One preference lists the name of the preferences that define each custom header for that identity. The others specify the custom header and the value. For example:

user_pref("mail.identity.idN.headers", "archive");
user_pref("mail.identity.idN.header.archive", "X-No-Archive: yes");

where 'N' is the appropriate id number. Notice that while the custom header is X-No-Archive its defined using a different name. You could add two custom headers for id3 using:

user_pref("mail.identity.id3.headers", "archive, gazette-tag");
user_pref("mail.identity.id3.header.archive", "X-No-Archive: yes");
user_pref("mail.identity.id3.header.gazette-tag", "X-gazette-tag: Bubba");

You can look in prefs.js or use Tools -> Options -> Advanced -> General -> Config editor to find the number of the identity. The simplest way to find the id value might be to search for the email address. mail.identity.id1.useremail for example contains my default email address.

Customize what headers you see

You can show the user agent and/or the organization header in the headers listed by View -> Headers -> normal by setting mailnews.headers.showOrganization or mailnews.headers.showUserAgent true using the Config Editor. You can add other pre-defined headers using mailnews.headers.extraExpandedHeaders . Separate each header in the list with a space, not a comma.

The Mnenhy extension adds additional menu commands to add or display custom headers.


The Enigmail extension needs to see all of the headers so it sets mail.show_headers to 2 and uses extensions.enigmail.show_headers to control what headers are displayed for the user. Enigmail also adds some custom headers to all outgoing mail if you add user_pref("extensions.enigmail.addHeaders",true); to user.js . It currently adds:

X-Enigmail-Supports: pgp-inline, pgp-mime

See also

External links