Roundcube Community Forum

Release Support => Release Discussion => Topic started by: paravis on May 06, 2013, 07:56:29 PM

Title: IMAP login domain mapped as alias email domain for user identity
Post by: paravis on May 06, 2013, 07:56:29 PM
Hello everyone --

A quick explanation about my mail environment ... I have Postfix/Dovecot authenticating off of Microsoft AD forest for multiple domains. The actual mail accounts and addresses are the same as the AD accounts -- for example, [email protected]. The routable email addresses are domain aliases -- for example, [email protected] from the outside internet, and [email protected]/[email protected] for internal use.

I currently have Postfix setup for virtual domains (specified in /etc/postfix/vhosts) and virtual mailboxes (in /home/vmail). For the user/account/mailbox aliases, I have a MySQL database that maps using a series of SQL queries. The relevant MySQL database table is called 'alias_domain', which has two columns of interest: 'alias_domain' and 'target_domain' -- alias_domain being the external domain, target_domain being the internal Active Directory domain.

My issue is that when the users log into Roundcube with their AD user/pass, the default email address that is setup in their identity is the same as their login -- for example, [email protected]. I would like to configure Roundcube so that it supplies the alias domain to each user's account, same as I have setup in Postfix -- for example, corpdomain.local -> corpdomain.net.

While great people, my users aren't exactly the most reliable or responsible when making simple changes to their own settings. Possibly there is a setting within Roundcube that I can change, or maybe a PHP file that can be modified to achieve this functionality?

It's been a long day, so hopefully I have described my situation properly. Any help or suggestions will be greatly appreciated. Thanks!
-- Laz
Title: Re: IMAP login domain mapped as alias email domain for user identity
Post by: paravis on May 07, 2013, 11:41:11 AM
Well, awkward me ...

I am now reading http://trac.roundcube.net/wiki/Howto_Config, and see the virtuser_query plugin. Seems like this *may* do the trick. I am going to look into this now.

Sorry for not checking the how to, I just figured the functionality was not already provided by default or by plugin.

If anyone knows if this plugin does *not* work, please advise. Thanks!
~Laz
Title: Re: IMAP login domain mapped as alias email domain for user identity
Post by: paravis on May 07, 2013, 12:49:47 PM
Great, it's fixed and working exactly as hoped for.

I am now using the virtuser_query : "SELECT CONCAT(mb.local_part, '@', ad.alias_domain) as email, mb.name as name, '' as organization, CONCAT(mb.local_part, '@', ad.alias_domain) as replyto FROM postfix.mailbox mb, postfix.alias_domain ad WHERE mb.username = '%u' and mb.domain = ad.target_domain" ...

All is well.  Wonderful piece of software ... Thanks!
~Laz