Roundcube Community Forum

 

Auto Determine Host From E-mail Address

Started by tealnet, December 30, 2006, 07:51:12 PM

Previous topic - Next topic

tealnet

Since we host multiple domains, it would be nice to have an option for the host to automatically determined from the e-mail address so users don't have to type it in. For example, if the username entered is  [email protected], the host could automatically be set to  mail.mydomain.com

Would anyone else find this to be helpful?


Insanity5902

If you ran the webmail from a different server as the mail server, then yes, this would be very useful.

I currently just run a single mail server, and run the webmail on it.

Take a look here. There are several people working on something similar, to grab the domain information form the http address and add it to the user name.

I like my solution the best, of course :), where I grab the header information, through it into an array, separated by periods, reverse it, then the array[0] is your tld (com, org, etc), array[1] is your next level of domain, etc.

You can grab this and then put it in the defualt host field, a crude code would be something like this

$tempDomain array_reverse(explode(".",$_SERVER['HTTP_HOST']));
$rcmail_config['default_host'] = 'ssl://mail' $tempDomain[1'.' $tempDomain[0] . ':993';


That is almost the exact code I use to grab the username_domain

dgec

I'm posting a further question on the other thread you mention.

com2

#4
Best would be when there is one roundcube for all servers for easy maintenance and one company link. My idea would be to add another variable or improve the behaviour of variable %s :

Quotedomain name after the '@' is used to do a dns mx look up. When there is only one mx, than that will be used. When there are more, then they will be listed in an array so the user can choose.

This will cover most cases just fine and can be easily accomplished with something like this:

<?php
if (getmxrr("gmail.com",$mxhosts)) {
  if (
count($mxhosts) == 1) {
    
$output $mxhosts[0];
  } else {
    foreach( 
$mxhosts as $mxhost) {
      
$output[$mxhost] = $mxhost;
    }
  }
  print(
"<pre>");
  
print_r($output);
  print(
"</pre>");
}