webmail

DirectAdmin Support said:
Yes, that should work to get "username" working, but then [email protected] will stop :)

I want both to work.. why can't uebimiau read my mind :)



Right.. But really what we need to do is make Uebimiau from spliting [email protected] and to keep it the same, so that if the user enters username or mailbox then just %user% would be what they entered.. I gotta look at the source some more :D
 
Alright I got it... I think..

Change in config.php:

PHP:
$one_for_all_login_type	= "%user%@%domain$";

To:

PHP:
$one_for_all_login_type	= "%user%";

Save and exit..

Then in /inc/inc.php:
Find:
PHP:
		if(ereg("(.*)@(.*)",$f_email,$regs)) {

			$f_user = $regs[1];

			$domain = $regs[2];

			if($one_for_all_login_type != "") $f_user = eregi_replace("%user%",$f_user,eregi_replace("%domain%",$domain,$one_for_all_login_type));

		}

Replace with:

PHP:
		//if(ereg("(.*)@(.*)",$f_email,$regs)) {

		//	$f_user = $regs[1];

		//	$domain = $regs[2];

		//	if($one_for_all_login_type != "") $f_user = eregi_replace("%user%",$f_user,eregi_replace("%domain%",$domain,$one_for_all_login_type));

		//}
                $f_user = $f_email;


Needs some beta testing but works on my servers...
 
Last edited:
Arrrgh....

Users can login.. But can't seem to send email because the domain isn't being defined for just the username.. Hmm...

Afraid to make the system assume server_name because a user might be using
www.hostsdomain.com/webmail/
 
Is there like a user's folder with DirectAdmin?

Like /usr/local/directadmin/users
and there is a file with the username, and inside would be the domain associated with it?

Thats the only way I can think of fixing this.. Is that the system username is looked up to on the server to get the correct domain...
 
Not sure if I made myself clear in my last post.. Thinking very fast here :)

When a user logs in.. It would check if in the format of [email protected]

If it is, go ahead and proccess the login..

If it doesn't have the @ in the username, which is safe to assume since unix usernames can't have that as part of the name :D

Then to check if the user exists on the system itself..

I would prolly assume some where like:
/var/directadmin/users/$username

And inside that file being DOMAIN: domain.com..

We grep that out and plug that into the varible $f_domain or whatever uebimiau uses :D

And go on our marry way... Its kinda slow to do the file load but only possible way I know of getting the domain associated with a unix username.. If the varible $_SERVER[server_name] was used, then any unix user on the server could goto another domain and send email from that domain.. Say [email protected] [email protected]

Not a good thing :D
 
yes ../users/username/domain.list
but its not readable by apache.

I'm trying a method of leaving the ereg stuff and just stomping over f_user = f_email after the if ereg {} .. so that domain willl be defined if it exists.
 
DirectAdmin Support said:
yes ../users/username/domain.list
but its not readable by apache.

I'm trying a method of leaving the ereg stuff and just stomping over f_user = f_email after the if ereg {} .. so that domain willl be defined if it exists.

But when somone just uses 'username' the system can't figure out what domain to append to the end for a complete email address..

The only other way to fix this would be to when a domain is added have the uebimiau config file updated with the correct array with the domain and server information.. But then users could still goto other domains and login via their unix system name and send email from that domain...

This is gonna be a fun one for the books :D
 
/etc/virtual/domainowners

holds all domains and the system username associated with it.

domain.com: username

.. would have to do a reverse lookup, but its readable by all... 644
 
DirectAdmin Support said:
/etc/virtual/domainowners

holds all domains and the system username associated with it.

domain.com: username

.. would have to do a reverse lookup, but its readable by all... 644


I'll do a quick code write up, I won't be able to test it really but if I give ya the source, I'm sure you can figure out how to tweak it and make it work...
 
wow, you really don't need to do that :) but if you "feel the need", by all means, be my guest.
 
DirectAdmin Support said:
wow, you really don't need to do that :) but if you "feel the need", by all means, be my guest.

Well I suggested Uebimiau so I brought it upon myself :D

PHP:
$arrUserfile = file("/etc/virtual/domainowners");
foreach ($arrUserfile as $line) {
    list($domainC, $usernameC) = explode(':', chop($line));
    $usernameC = ltrim($usernameC, " ");
    if($usernameC == $f_user) {
        $f_domain = $domainC;
        break;
    }
}

The check would need to be something like that.. Its not tested but it looks about right.. And should be close with the varible names... Coding from memory :D
 
DirectAdmin Support said:
ok, I'll insert that. Thanks again.


You'll need to check varible names.. Because I'm sure I had to miss something.. That coded way to easy :D

My pleasure to help..
 
Alright..

If we do it this way.. There might need to be a change made to DirectAdmin and how it creates email accounts...

As of right now.. When the unix user sends an email it will come from [email protected].. To make this more clear I'll use one of my names..

[email protected]

But what if I created a pop3 user in DirectAdmin with the username [email protected].. I as the domain root user could send email, and then never receive the reply because its being sent to that pop3 box.. Thats considering I give it to someone else for some reason..

So there would need to be a check to make sure you can't make an extra pop3 box called [email protected].. I know its unlikely to happen, but it helps to idiot proof things :D
 
it wouldn't let you create that account because it already does a check to make sure that you don't do that.
 
DirectAdmin Support said:
it wouldn't let you create that account because it does a check to make sure that you don't do that.


Alright good.. I was just walking around my room thinking of future support requests because of something like that :D
 
For those who have been following this thread:

Webmail is working perfectly now. :)

If you are having any kind of sign in error, first change your password in the control panel and then change it back. This should fix it.

Mark
 
Back
Top