zmmailbox PERL script
Posted: Fri Dec 07, 2012 3:30 pm
I modified an existing script from another forum thread, which automatically mounts a shared address book to my users within a existing Distribution List. Here is the code:
#!/usr/bin/perl
# Get distribution list information and filter to just it's members
my $gdl = `/opt/zimbra/bin/zmprov gdl distributionlist@domainname|grep zimbraMailForwardingAddress:`;
my @dlmembers = split('
', $gdl);
foreach $member(@dlmembers){
$member =~ s/zimbraMailForwardingAddress:s*|s*$//g;
print "$member
";
system ("/opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account@domainname /sharename");
}
When I run the above PERL script, the output from the "get distribution list information" works, however it doesn't process the zmmailbox command. It returns the following error message after trying to run it for each distribution list member:
ERROR: service.PERM_DENIED (permission denied: you do not have sufficient permissions)
Additional Info
- The permissions have been set appropriately on the account that the address book is being shared from. Within the web client, I can see that my distrubition list is shared and the permissions are set to 'Manager'.
- When I run the 'zmmailbox' command separately, removing $member and adding in an individual account that is a member of the distribution list, it works with no problem.
I suspect this issue is related to the PERL setup or something else related to Linux, however I am unable to figure it out.
If you have any ideas or suggestions, please reply. Thank-you in advance.
#!/usr/bin/perl
# Get distribution list information and filter to just it's members
my $gdl = `/opt/zimbra/bin/zmprov gdl distributionlist@domainname|grep zimbraMailForwardingAddress:`;
my @dlmembers = split('
', $gdl);
foreach $member(@dlmembers){
$member =~ s/zimbraMailForwardingAddress:s*|s*$//g;
print "$member
";
system ("/opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account@domainname /sharename");
}
When I run the above PERL script, the output from the "get distribution list information" works, however it doesn't process the zmmailbox command. It returns the following error message after trying to run it for each distribution list member:
ERROR: service.PERM_DENIED (permission denied: you do not have sufficient permissions)
Additional Info
- The permissions have been set appropriately on the account that the address book is being shared from. Within the web client, I can see that my distrubition list is shared and the permissions are set to 'Manager'.
- When I run the 'zmmailbox' command separately, removing $member and adding in an individual account that is a member of the distribution list, it works with no problem.
I suspect this issue is related to the PERL setup or something else related to Linux, however I am unable to figure it out.
If you have any ideas or suggestions, please reply. Thank-you in advance.