Created
June 12, 2009 16:04
-
-
Save koke/128730 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use EBox; | |
use EBox::Global; | |
EBox::init(); | |
my $usersModule = EBox::Global->modInstance('users'); | |
koke@rick:~/scripts$ vim maillist.pl | |
koke@rick:~/scripts$ vim maillist.pl | |
koke@rick:~/scripts$ cat maillist.pl | |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use EBox; | |
use EBox::Global; | |
use Data::Dumper; | |
if ($#ARGV != 0) { | |
print "Usage: $0 domain\n"; | |
print $#ARGV; | |
exit; | |
} | |
EBox::init(); | |
my $mod = EBox::Global->modInstance('mail'); | |
my $domain = $ARGV[0]; | |
my $users = $mod->{musers}->allAccountsFromVDomain($domain); | |
my $fusers = {}; | |
my $mail; | |
foreach my $uid (keys %$users) { | |
$mail = $users->{$uid}; | |
$fusers->{$uid} = [$mail]; | |
print "\nUser: $uid\n"; | |
print "Email: $mail\n"; | |
foreach my $alias ($mod->{malias}->accountAlias($mail)) { | |
print "Alias: $alias\n"; | |
push(@{$fusers->{$uid}}, $alias); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment