zmmailbox PERL script
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:
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:
# 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('\n', $gdl);
$member =~ s/zimbraMailForwardingAddress:\s*|\s*$//g;
system ("/opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account@domainname /sharename");
ERROR: service.PERM_DENIED (permission denied: you do not have sufficient permissions)
- 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.
that looks more like the permissions for the shared addressbook aren't correct. have you verified that the permissions on hte addressbook include everone on the distribution list?
Hi bdial - thank you for your reply.
When I look in the web client at the properties of the shared address book, I see that the distribution list has 'manager' permissions (see image)
Is there something else I am missing?
have you tried doing it manually for one or two of the members to see if that works? it's definately a zimbra problem and not a perl problem. I just tried to use zmmailbox from the cli to mount my boss's inbox (i don't have permissions) and got the exact error. It could be a problem with escaping characters or something perhaps the right folder name isn't making it through and you need more quotes? Just verifying it works manually would help you get closer to the isssue
Actually I was missing a backslash in the second command:
Incorrect = /opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account@domainname /sharename
Correct = /opt/zimbra/bin/zmmailbox -z -m $member createMountpoint --view contact -F# /sharename account\@domainname /sharename
Sorry about that, it ended up being my silly mistake. Thanks for suggesting that it may have been a syntax issue, that pointed me in the right direction.