Re: Multiple domains ...

Torsten Mueller <[email protected]>
Newsgroups gmane.mail.neomail.general
Message-ID <[email protected]>

Valics Lehel schrieb:
> 
> Can you guide me?
> Just some hints to find out easier ...

O.k.

a new file, called domainfind.pl.
In this file is a subroutine, called 
domainfind. It looks as follows:

#####################
sub domainfind {
$testname = $_[0];

$dsn = "DBI:mysql:database=$SQL_DB;host=$SQL_HOST;port=$SQL_PORT";
$dbh = DBI->connect($dsn, $SQL_ACC, $SQL_PWD);
$drh = DBI->install_driver("mysql");
$quotedtestname = $dbh->quote($testname);
$gselect="select domain from mail where user=$quotedtestname";
$sth = $dbh->prepare($gselect);
$sth->execute;
while($ref = $sth->fetchrow_hashref) {
$tdomain = $ref->{domain};
}
$sth->finish;
$dbh->disconnect;

#print "\n\n\n\ndomain: $tdomain\n\n";
return $tdomain ;
}
1;
#####################
Of course you need to modify it, to do a text search or
whatever to find the right domain.

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.

Of course this is expandable, as a user could select
more domain names, depending of the username.

Hope this helps.


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.