Roundcube Community Forum

 

removing @domain.com from login

Started by tal, August 07, 2006, 10:53:28 AM

Previous topic - Next topic

tal

Hey,

just to be a pain, how do i make it so i dont have to add @domain.com when i log on???
like what scripts do i have to edit, and what need to be changed... and with what :P

sorry for being an annoyance,
Tal

schroder

in main.inc.php
... add your domain name to $rcmail_config['default_host'] = ''; on line 38

(I had just the same issue)

yfastud

Already did it, and it did hide domain at login screen, but wonder how to configure so only input username instead the full email address. Any idea?
Thanks a million

Scubes13

First of all, the quickest way (if you use a single domain) might be to follow the instructions from Brett about listing the domains in a drop down or adding a single domain to the config file. His instructions can be found here: http://roundcubeforum.net/forum/index.php?topic=212.msg1078#msg1078


However, our company hosts several domains on one server. When implementing a software such as roundcube, we like to have one central install that eases the pains of configuring and maintaining. Each domain hosted simply references the central install via sym-links.

Anyways, whether that makes sense or not, I wanted to setup a way that the login screen would figure out the mail server domain name without me having to manually set it in a config file or the user inputting it at each login. So, I basically switched out line 33 of main.inc.php with this line:

$rcmail_config['default_host'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

Basically, it takes the address in the address bar, removes the "//www." and adds "mail." to the beginning of the domain name.

Ex) //www.yourname.com to yourname.com to mail.yourname.com

I am sure this all seems very basic and straight forward to the more seasoned programmer, but I was excited about getting it to work.

We also then use the same principal to generate the SMTP server address and the username. It looks as follows:
// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u' . '@' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';

Hope it helps in some way.

Kevin L.



schroder

Quote from: yfastud how to configure so only input username instead the full email address

Surely that's a server issue and the 'long user names' option seems to have been selected. Hope you have a a control panel to adjust that because I haven't a clue how to recommend raw code.

jbouklas

Quote from: Scubes13 First of all, the quickest way (if you use a single domain) might be to follow the instructions from Brett about listing the domains in a drop down or adding a single domain to the config file. His instructions can be found here: http://roundcubeforum.net/forum/index.php?topic=212.msg1078#msg1078


However, our company hosts several domains on one server. When implementing a software such as roundcube, we like to have one central install that eases the pains of configuring and maintaining. Each domain hosted simply references the central install via sym-links.

Anyways, whether that makes sense or not, I wanted to setup a way that the login screen would figure out the mail server domain name without me having to manually set it in a config file or the user inputting it at each login. So, I basically switched out line 33 of main.inc.php with this line:

$rcmail_config['default_host'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

Basically, it takes the address in the address bar, removes the "//www." and adds "mail." to the beginning of the domain name.

Ex) //www.yourname.com to yourname.com to mail.yourname.com

I am sure this all seems very basic and straight forward to the more seasoned programmer, but I was excited about getting it to work.

We also then use the same principal to generate the SMTP server address and the username. It looks as follows:
// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'mail.' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u' . '@' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';

Hope it helps in some way.

Kevin L.




I tried that method, to no avail. When I log in, I have to type [email protected]. Shouldn't this allow you to just type in username, and it automatically sends @mydomain.com?

-Jim

Scubes13

That is what it should do.


Because the line:

$rcmail_config['smtp_user'] = '%u' . '@' . '' . str_replace("[url]www."[/url], "", $_SERVER['HTTP_HOST']);
...should generate 'username' + '@' + 'domain.ext' as a string. Again, check your SMTP-Auth logs and let us know what you see.

You may want to check your logs to see what it is actually outputting as the username when it tries to login. (IE - see if something else is being appended to the username that is dorking it.)

I have been running the above posted code for quite a while, across many versions of RC, including the current Beta 2.

Kevin L.

sleezstak


Scubes13

It should. It is only acquiring the HTTP_HOST which would be the domain name. (IE - //www.domain.ext)

Kevin L.

SViRU

When you have one domain, ( multiple domain not tested )

Just only need to edit main.inc.php in line 46

// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['username_domain'] = 'your.domain.com';

then you can login only with username

if you have aliases for account, example n.surname:username

you need to create file virtuser and put them:
## virtuser ##
[email protected]  username
## eof ##

next you must edit line 53 in file main.inc.php

// Path to a virtuser table file to resolve user names and e-mail addresses
$rcmail_config['virtuser_file'] = 'config/virtuser'; ( your patch, i create file in config dir )

and you can login to webmail as username or n.surname without @your.domain.com





jbouklas

VIRUS, thanks! That adding the "mail_domain" part did the trick. Now I'm going to start playing with virtusers.

-Jim

finch13

I've got a similar question,

When I login I need to use this format: user+domain.com

for some reason my login is + instead of @.

I'm a single domain user, so I don't need fancy pull downs, but how can I make it so I just need to type in "user"?

I tried modifying main.inc.php $rcmail_config['username_domain'] = $rcmail_config['username_domain'] = 'domain.com'; with no success.

Any ideas?

andresme

So do you have to add this string into the table? I don't seem to have this in my main.inc.php file

// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['username_domain'] = 'your.domain.com';

If so, what is the "your" part or yourdomain.com the same?

I tried inserting / pasting that into my file where line 46 would be and using domain.com but it didn't work either.

I also tried putting my domain in line 38... but it doesn't like that either.

From what I understand... my line 38 has to say 'localhost'.

Any ideas?

schrab

Quote from: finch13 I've got a similar question,

When I login I need to use this format: user+domain.com

for some reason my login is + instead of @.

I'm a single domain user, so I don't need fancy pull downs, but how can I make it so I just need to type in "user"?

I tried modifying main.inc.php $rcmail_config['username_domain'] = $rcmail_config['username_domain'] = 'domain.com'; with no success.

Any ideas?

I have got a similar problem: my imap mailserver login string format is "domain.com+user" and RC returns error:

QuoteIMAP Error: Authentication for domain.com+user failed (LOGIN): "a001 NO LOGIN failed: Login failed. Either your user name or your password was wrong. Please try again, and if the problem persists, please contact your system administrator."