Hi Maurice,
> Is there a call to get the full mailaddress (from p.e. the virtusertable)
> when I know the username?
Quick, dirty and inefficient, but it does the trick:
---------------------------------------------------------------------------------------------------------
#!/usr/bin/perl
$username="OURUSERNAME"; #<-- we assume this user exists
$path = "~" . $username;
$cwd = (`cd $path ;pwd`);
print "$cwd \n";
if ($cwd =~ /^\/home\/.sites\/(.*)\/(.*)\/.users\/(.*)\/(.*)/i) {
$sitenumber = $2;
}
@two = (`ls -l /home/sites/`);
foreach $line (@two) {
if ($line =~ /^lrwxrwxrwx(.*)[0-9}[0-9]:[0-9][0-9] (.*) -> ..
\/.sites\/(.*)\/$sitenumber/i) {
$domain = $2;
}
}
$email-address = "$username\@$domain\n";
print "$email-address\n";
---------------------------------------------------------------------------------------------------------
From Perl and as unprivileged user you cannot read /etc/mail/virtusertable.db
on BQ, as that file is owned by user "smmsp" and has 640 permissions. Even if
you could read the .db, you'll need DB::File to decode it and get at the
stored values.
The textfile /etc/mail/virtusertable has more relaxed permissions and it's
possible to read it as unprivileged user. However, if you parse it for a
username it might also return all aliases that are associated with that
username and then it gets messy.
--
With best regards,
Michael Stauber