Changes

Thunderbird

3,522 bytes added, 15:19, 19 January 2012
Autoconfig: with Active Directory
You can add functionality to the prefs by including javascript within the file.
===== Method 1 =====
Example thunderbird.cfg with automatically assigned values from ldap.
</source>
===== Method 2 (use for Active Directory) =====
Since method 1 did not work for me, even after I changed the attribute names, I found an other [http://blog.deanandadie.net/2010/04/ldap-queries-in-mission-control-desktop/ example].
I use SSL here, so if you don't remove the SSL-part. It is generally a good idea to configure a client manually and then look inside about:config for the settings.
 
<source lang="javascript">
//Note: for accessing the Active Directory of Windows Server later than 2000
//it is necessary to allow anonymous read access. Please see
//(German) http://interop.blog.de/2010/02/13/kapitel-1-ldap-anfragen-linux-ad-8001564/
//or search the net how to do it. If it is not possible to give access to anonymous,
//you have to enable this function first, please see
//http://technet.microsoft.com/de-de/library/cc816788(WS.10).aspx
//
//
//put everything in a try/catch
try {
 
var userInfo = new Object(); // This will hold LDAP results
userInfo.envUser = getenv("USERNAME"); // USERNAME
userInfo.envHome = getenv("HOME"); // User home directory
var ldapHost = "example.com";
var ldapBase = "dc=company,dc=local";
if( userInfo.envUser )
{ var ldapFilter = "sAMAccountName=" + userInfo.envUser; }
else
{ throw("Couldn't get UID from the environment"); }
 
// LDAP attributes to retrieve from the server
var ldapAttrs = new Array( "cn", "mail", "sAMAccountName" ); // add more attributes here, if needed)
 
// Define how to process LDAP results before we make the call
function processLDAPValues(queryResults)
{ if( queryResults )
{ // Build the userInfo object for later use
for( var attr in ldapAttrs )
{ userInfo[ ldapAttrs[attr] ] = getLDAPValue( queryResults, ldapAttrs[attr] ); }
} else
{ throw( "No LDAP results" ); }
}
 
// Call upon LDAP for the values in ldapAttrs array,
// Uses the previous processLDAPValues()
getLDAPAttributes( ldapHost, ldapBase, ldapFilter, ldapAttrs.join(",") );
 
// create account
// see also http://blog.deanandadie.net/2010/06/easy-thunderbird-account-management-using-mcd/
// Identity
defaultPref("mail.identity.id1.fullName", userInfo.cn );
defaultPref("mail.identity.id1.smtpServer", "smtp1" );
defaultPref("mail.identity.id1.useremail", userInfo.mail );
 
// IMAP server settings
defaultPref("mail.server.server1.hostname", "myImap.server.com" );
defaultPref("mail.server.server1.name", userInfo.mail );
defaultPref("mail.server.server1.port", 993 );
defaultPref("mail.server.server1.socketType", 3 );
defaultPref("mail.server.server1.type", "imap" );
defaultPref("mail.server.server1.userName", userInfo.mail );
 
// SMTP server settings
defaultPref("mail.smtpserver.smtp1.authMethod", 3 );
defaultPref("mail.smtpserver.smtp1.description", "my Company Name" );
defaultPref("mail.smtpserver.smtp1.hostname", "mySmtp.server.com" );
defaultPref("mail.smtpserver.smtp1.port", 465 );
defaultPref("mail.smtpserver.smtp1.try_ssl", 3 );
defaultPref("mail.smtpserver.smtp1.username", userInfo.mail );
 
// Glue it all together
defaultPref("mail.account.account1.identities", "id1" );
defaultPref("mail.account.account1.server", "server1" );
defaultPref("mail.accountmanager.accounts", "account1" );
defaultPref("mail.accountmanager.defaultaccount", "account1" );
defaultPref("mail.smtp.defaultserver", "smtp1" );
defaultPref("mail.smtpservers", "smtp1" );
 
// Close the try, and call the catch()
} catch(e) {
displayError("lockedPref", e);
}
 
</source>
 
--[[User:Konus|Konus]] 16:19, 19 January 2012 (CET)
== Prefs ==
65
edits