0

I'm right now in a massive email migration to Google Application (GMail). I must change all the server settings in each Thunderbird client of all my users. I have the Administrator password of each PC, but not the user password where the Thunderbird profiles are.

Does there exist a way to edit a file inside Thunderbird profile using the Administrator rights and change SMTP-IMAP-POP3 setting of users accounts? Edit or execute a command, or replace a file.

1 Answer 1

1

There is a way, though it needs just a little bit of javascript knowledge. You have to:

  1. Apply two config files inside the installation dir
  2. 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:

  1. 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)
  2. For each account, checking if that's the account you want to fix (using one of the subparameters, like: mail.server.<servername>.hostname)
  3. 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
3
  • Thanks for your reply. This is too much work to do in my case at point that turn inefficient this method in my case. As I said I have access to users profile because I have Administrator access to the PC, what let me ask you if exist a simplest way to do this? I just thought that I could change users servers setting overwriting some kind of user's conf files or executing some kind of commands.
    – user193540
    Sep 14, 2013 at 3:00
  • 1
    Well, the settings are stored within prefs.js file in each user's profile, yet it would be much harder to replace it - the file contains all user config, including windows-user-specific paths. You would have to rewrite specific lines only, and then still you would have to manually reach each user profile since it does contain a randomly-named folder in the path: `%AppData%\Roaming\Thunderbird\Profiles\<random>.default`. With all that in mind, creating single script file and deploying it across all computers. Sep 14, 2013 at 9:07
  • ...and when you said "massive", I've made a loose assumption of at least 1000+ PC's, which would it really worth the effort :D Sep 14, 2013 at 9:08

You must log in to answer this question.