Author Topic: Dynamically adding domain to the username string  (Read 3319 times)

Offline WiZaxx

  • Newbie
  • *
  • Posts: 6
Dynamically adding domain to the username string
« on: July 05, 2012, 07:54:33 AM »
I have found  out that  main.inc.php can be used to add a domain to the username string: so a user can login with just name and rouncube will turn the string to name@domain.com.

I have ONE roundcube behind ZPanelX on a CentOS server where I host a number of domains. For each domain I have a webmail subdomain pointing to the same roundcube.

Now, here is my question:

Can I have users logging in from a given subdomain use only the name and have roundcube dynamically add that domain to the username?

i.e.:
If Bobby is logging in through webmail.bobbydomain.com I could set bobbydomain.com in main.inc.php: bobby could just login as bobby and roundcube would add the domain to the username string.
BUT what if I would like to have Tommy logging in through webmail.tommydomain.com to just login as tommy and have roundcube to add tommydomain.com to the username?
AND so on for the other domains?

If possible, how would I do that? and please be patient as you are dealing with a code-challenged person here :-[
« Last Edit: July 05, 2012, 08:38:20 AM by WiZaxx »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: Dynamically adding domain to the username string
« Reply #1 on: July 05, 2012, 10:02:42 AM »
what version of Rouncube are you using? I think it was in 0.4 that the macros were introduced for the username_domain option and it sounds like %d is the one you want. they are explained in the comments in the config file.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline WiZaxx

  • Newbie
  • *
  • Posts: 6
Re: Dynamically adding domain to the username string
« Reply #2 on: July 06, 2012, 02:29:00 AM »
Thank you for the prompt reply.
I have 0.7 installed and I will look in the config file to find that out....


Offline WiZaxx

  • Newbie
  • *
  • Posts: 6
Re: Dynamically adding domain to the username string
« Reply #3 on: July 07, 2012, 05:38:53 AM »
For what I gathered, with those variables I can only control access to ONE domain. Unless I am missing soething.....

Can someone post a real world example to illustrate how those settings work?

Thank you

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Dynamically adding domain to the username string
« Reply #4 on: July 07, 2012, 05:54:50 AM »
You should be able to set $rcmail_config['username_domain'] to "%d" to do what you want.