Trac lacks capability to sync any data (including email) from LDAP, so I wrote
a Python script to do email syncing it. Basically the script pokes directly at the Trac database, but with caution. Doing the same for phpbb would probably be easier, as Trac's concept of users is funky (i.e. there are not really users, but authenticated and non-authenticated sessions).