Re: sub-domains
Torsten Mueller <[email protected]> Wed, 12 Nov 2003 08:15:31 +0100
| Newsgroups | gmane.mail.neomail.general |
|---|---|
| Message-ID | <[email protected]> |
Torsten Mueller schrieb:
> It's not a big thing to implement this. If i remember
> corrcetly, this was already discussed here.
> But i am not sure, if a patch already was posted.
Reading my own mail from Tue, 15 Jul 2003 19:58:45 +0200
with the subject "Multiple domains ..."
i would do the following:
Create a new file, called domainfind.pl
in /var/neomail/.
In this file is a subroutine, called
domainfind. It looks as follows:
#####################
sub domainfind {
my $testname = $_[0];
my $tdomain =
"default.domain.name.if.no.domain.name.is.provided.here.com";
my %tdomhash;
# add here more mappings
$tdomhash{"fred"} = "fred.caladan.co.uk";
$tdomhash{"barbara"} = "barbara.caladan.co.uk";
$tdomhash{"torsten"} = "torsten.caladan.co.uk";
if (lenghth($tdomhash{$testname}) > 0) {
$tdomain = $tdomhash{$testname};
}
# or if every domain is ending with caladan.co.uk you don't need to
create mappings,
# simply uncomment the following
# $tdomain = $testname . ".caladan.co.uk";
return $tdomain ;
}
1;
#####################
Now the neomail part:
The user domain will be setup in
neomail-prefs.pl, so this is the only file, that needs to
be modified.
Below
'require "neomail.conf";'
add
'require "domainfind.pl";'
to make the subroutine available within neomail-prefs.pl.
Now find:
'$html =~ s/\@\@\@USERNAME\@\@\@/$temphtml/;'
and add below it:
'$domainnames[0] = &domainfind($user);'
That's it.
The first domain from @domainnames will be "overwritten"
by the value from the subroutine domainfind.
This assumes, that in neomail.conf is only defined one domain,
which will "never" be used.
Please pay attention, that this routine is a starting point.
You should make sure, that the user doesn't misuse
the form, to provide another domain name.
Torsten
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/