Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#1484405 closed Feature Requests (wontfix)

Getting the domain from webmail URL

Reported by: ligesh Owned by:
Priority: 5 Milestone:
Component: User Interface Version: 0.1-rc1
Severity: normal Keywords:
Cc:

Description

Hi,
I would like to know if it is possible to add a feature so that the domain for the mail would be automatically gathered from the url and the user only has to enter his username, and not the entire 'user@…'.

For instance, the webmail client would be located at webmail.domain.com, so roundcube can automatically get the domain name by parsing the url, and then it can show this domain name statically in the login page for the username, so that it would be very clear that the user only has to enter the username, and not the entire mail string.

Thanks in advance.

Change History (11)

comment:1 Changed 6 years ago by ligesh

  • Component changed from Client to Interface improvements
  • Type changed from Bugs to Feature Requests

comment:2 Changed 6 years ago by phs

  • Resolution set to invalid
  • Status changed from new to closed

hi

this feature is already included in roundcube. you can configur it in "main.inc.php". enter your domain in the following line:

$rcmail_config['username_domain'] = 'domain-here';


if you do this correctly your users can only login with their username.

comment:3 Changed 6 years ago by phs

  • Resolution invalid deleted
  • Status changed from closed to reopened

sorry, i think i understood you wrong...
you want roundcube to show the domain in the login interface statically after the username field.

comment:4 Changed 6 years ago by ligesh

Hi,

Thanks for the response.

The feature you have mentioned uses a static domain. I need the domain to be dynamically parsed out of the url for the webmail. The same webmail application should work for many domains, typically in a shared hosting setup. So roundcube should figure out the domainname from the url of the script.

$domain = strfrom($_SERVERhostname?, "webmail.");

And then this domain should be shown in the login page too. The feature you have posted will work if roundcube was to work for a single domain, but i need it to work in a shared hosting setup.

Thanks a lot.

comment:5 Changed 6 years ago by thomasb

Since the config file is also PHP code, you can use any function to set $rcmail_configusername_domain? to a value depending on the current request.

What we need to complete your request, is a template object, that can display any value from config.

comment:6 Changed 6 years ago by moc

I have the same feature request.
In my company (a hosting provider) we use the same roundcube installation for many domains. Now every user has to enter the entire email address to log in.

comment:7 Changed 6 years ago by thomasb

  • Resolution set to fixed
  • Status changed from reopened to closed

There is also the possibility to include host-specific config files. Just set

$rcmail_config['include_host_config'] = true;

and create a file named yourhostname.inc.php in your config folder.

That specific config does not need to contain all parameters but just those which differ from the default config. The files will be merged.

comment:8 Changed 6 years ago by ligesh

  • Resolution fixed deleted
  • Status changed from closed to reopened

Since the config file is also PHP code, you can use any function to set $rcmail_configusername_domain? to a value depending on the current request.

What we need to complete your request, is a template object, that can display any value from config.

Hi,

You are actually right about the above. The only thing needed is the ability to show the domain statically in the login page. In fact, if the $rcmail_configusernamedomain? is set, then that particular value should be shown the login page. The config value can set to the specific value by parsing the url.

Sorry to open this again.

Thanks.

comment:9 in reply to: ↑ description Changed 6 years ago by bartley

This is the code I use to gather the http header. In fact I have it in use now having modified the main.inc.php file to include the following

::begin code::

/* initalize the host name */

/* we have to calculate a host name */
/* start with the host name from the url */

$domain = getenv('HTTP_HOST');
$domain = str_replace("webmail.", "", $_SERVERHTTP_HOST?);

/* trim useless things on the front */
if (strcmp(strtolower(substr($domain,0,5)),"webmail.") == "") {

/* remove the webmail. from the front of the string */
$domain = substr($domain,5);

}

if (strcmp(strtolower(substr($domain,0,4)),"www.") == "") {

/* remove the www. from the front of the string */
$domain = substr($domain,4);

}

::end code::

After adding this modify the following line to use the variable $domain
$rcmail_configusername_domain? = $domain;
$rcmail_configmail_domain? = $domain;
$rcmail_configproduct_name? = $domain;

it works, check it out.

This way, if you have multiple domains that need to use the same installation of roundcube, you won't have to configure the webmail for it, it'll just work, plus it'll only work with YOUR domains, no one can enter their email address from any other domain.

Replying to ligesh:

Hi,
I would like to know if it is possible to add a feature so that the domain for the mail would be automatically gathered from the url and the user only has to enter his username, and not the entire 'user@…'.

For instance, the webmail client would be located at webmail.domain.com, so roundcube can automatically get the domain name by parsing the url, and then it can show this domain name statically in the login page for the username, so that it would be very clear that the user only has to enter the username, and not the entire mail string.

Thanks in advance.

comment:10 Changed 6 years ago by till

  • Resolution set to wontfix
  • Status changed from reopened to closed

comment:11 Changed 6 years ago by thomasb

Follow-up in #1484549

Note: See TracTickets for help on using tickets.