There is a way, though it needs just a little bit of javascript knowledge. You have to:
- Apply two config files inside the installation dir
- Use them to change global configuration, applied to all users
Now, in short:
Step 1: Setting common config definition file
Go to the the Thunderbird program folder (ie. %ProgramFiles%\Mozilla Thunderbird
) and create a file: defaults\pref\local-settings.js
Add a following content:
pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");
This will tell Thunderbird to use %ProgramFiles%\Mozilla Thunderbird\mozilla.cfg
file as a config template.
Step 2: Configuring mailboxes
Now, in mozilla.cfg
you have to define mailbox settings. Basically, you will work with Mozilla config variables - the same that you see when you type about:config
in the Firefox address bar or when you launch Settings Editor in Thunderbird.
With this file and with following functions, you may affect Thunderbird config globally (that is, for each user running Thunderbird from the same install location). The functions are:
defaultPref( PrefName, Value )
- sets the default value (user can overwrite it)
lockPref( PrefName, Value )
- forces specific value (user cannot overwrite it)
pref( PrefName, Value)
- forces specific value (user can overwrite for session duration)
You can also read any pref:
getPref( PrefName )
- reads value
You have almost full JavaScript capability. Server configuration is stored within mail.server.<servername>.*
tree.
You do not know the <servername>
component. It's value is server#
, with #
being a consecutive number assigned at creation, though you do not know in what order did the user create his accounts and if he did not delete any of his accounts.
But, using javascript, you may find the correct <servername>
by:
- Looping throough all values stored in the
mail.accountmanager.accounts
variable (it contains comma-delimited list of all accounts, like: account1,account10,account3,account7,account2
)
- For each account, checking if that's the account you want to fix (using one of the subparameters, like:
mail.server.<servername>.hostname
)
- Once you'll find correct
<servername>
, change it's config as desired.
Sample code
This is a simple algorithm for mozilla.cfg
you may use to begin with:
var allServersString = getPref( "mail.accountmanager.accounts" );
var i, serverName, myServerConfig, allServers = allServersString.split(",");
// For each account...
for ( i = 0; i < allServers.length; i++ ) {
// Get account number
serverName = "server" + allServers[i].substr(7);
// If hostname of account matches our hostname, we found our `servername`
if ( getPref( "mail.server." + serverName + ".hostname" ) == "imap.myOldServer.com" )
myServerConfig = "mail.server." + serverName;
}
// Change parameters at your discretion...
pref( "aaa." + myServerConfig + ".hostname", "imap.myNewServer.com" );
// ...
Notes
- You may have to experiment a little with choosing right
pref/lockPref
function that will best suite your needs
- You will have to do the same thing for SMTP servers, but it's a little bit more tricky. Once you know correct
<servername>
you need to use the #
from <servername>
, then get list of identities identifiers idXXX
from mail.account.account#.identities
, and change parameters of each identity assigned to account (stored in mail.identity.idXXX.*
. Voila! :D