Zimbra CLI Commands: Distribution List | Zimbra

Document
Alert! This article is written for Zimbra OSE users. As of December 2023, Synacor will no longer be providing support for Zimbra OSE. You might want to consider trying out Carbonio Community Edition – Zextras’s free and open-source email and collaboration platform.

For additional guidance, check out our community articles detailing the process of migrating from your current platform to Carbonio CE.

A distribution list is a mail address which contains a group of email addresses. When a user send a message to a distribution list, he’s going to send it to everyone who has his email address within the list. The address line displays the distribution list address; the individual recipient addresses cannot be viewed by the recipient, while the sender using webmail can expand distribution list and see all members.

A distribution list can be managed via CLI commands only by an Administrator. Using web interface, instead, the admin can set up one or more lists owner who will be able to manage list from webmail under contacts tab.

MANAGING DISTRIBUTION LIST

Now we are going to see some zmprov CLI commands to manage a distribution list. As usual, for every command, we will show you the extendend and short form, the syntax to be used and an example to better help you understand how it works.

Remember that all commands are intended to be executed logging in as Zimbra user, with the command: su - zimbra

Create Distribution List:

To create a Distribution List you need to use CreateDistributionList (cdl) with the following syntax:

zmprov CreateDistributionList {yourlist@yourdomain}

Example:

zmprov CreateDistributionList SampleList@yourdomain.com

Delete Distribution List:

To delete a Distribution List you need to use DeleteDistributionList (ddl) with the following syntax:

zmprov DeleteDistributionList {yourlist@yourdomain|id}

Example:

zmprov DeleteDistributionList SampleList@yourdomain.com

Modify Distribution List:

To modify a Distribution List you need to use ModifyDistributionList (mdl) with the following syntax:

zmprov ModifyDistributionList {yourlist@yourdomain|id} attr1 value1 {attr2 value2...}

Example:

zmprov ModifyDistributionList SampleList@yourdomain.com

Rename Distribution List:

To rename a Distribution List you need to use RenameDistributionList (mdl) with the following syntax:

zmprov RenameDistributionList {yourlist@yourdomain|id} {newListName@yourdomain}

Example:

zmprov RenameDistributionList SampleList@yourdomain.com NewSampleList@yourdomain.com

Add a member to a Distribution List:

To add a member to a Distribution List you need to use AddDistributionListMember (adlm) with the following syntax:

zmprov AddDistributionListMember {yourlist@yourdomain|id} {user@yourdomain}

Example:

zmprov AddDistributionListMember SampleList@yourdomain.com john@yourdomain.com

Remove a member to a Distribution List:

To remove a member to a Distribution List you need to use RemoveDistributionListMember (rdlm) with the following syntax:

zmprov RemoveDistributionListMember {yourlist@yourdomain|id} {user@yourdomain}

Example:

zmprov RemoveDistributionListMember SampleList@yourdomain.com john@yourdomain.com

Get all Distribution Lists:

To get all Distribution Lists you need to use GetAlldistributionLists (gadl) with the following syntax:

zmprov GetAllDistributionLists [-v]

The -v attribute, stands for verbose. Verbose mode dumps full exception stack trace

Get Distribution List Membership:

To get a Distribution List Membership you need to use GetDistributionListmembership (gdlm) with the following syntax:

zmprov GetDistributionListMembership {yourlist@yourdomain|id} {user@yourdomain}

Get Distribution List:

To get a Distribution List you need to use GetDistributionList (gdl) with the following syntax:

zmprov GetDistributionList {yourlist@yourdomain|id}

Example:

zmprov GetDistributionList SampleList@yourdomain.com

Add an Alias to a Distribution List:

To add an Alias to a Distribution List Membership you need to use AddDistributionListAlias (adla) with the following syntax:

zmprov AddDistributionListAlias {yourlist@yourdomain|id} {yourlistalias@yourdomain}

Example:

zmprov AddDistributionListAlias SampleList@yourdomain.com ExampleList@yourdomain.com

Remove an Alias to a Distribution List:

To remove an Alias to a Distribution List Membership you need to use RemoveDistributionListAlias (rdla) with the following syntax:

zmprov RemoveDistributionListAlias {yourlist@yourdomain|id} {yourlistalias@yourdomain}

Example:

zmprov RemoveDistributionListAlias SampleList@yourdomain.com ExampleList@yourdomain.com

DYNAMIC DISTRIBUTION LIST

Dynamic Distribution List, like the standard one, can be created both using Graphic Interface through web client and Command Line Interface, that is the one we are going to use here.

A DDL allows users to add and remove members from a distribution list (DL) automatically. A new user is added as a member to the DL if he matches the filter previously added to distribution list.

The difference between Distribution List and Dynamic Distribution List is the Member URL, which is available only if the DL is marked as Dynamic Group. The Member URL is in charge of the default rule that will be applied to filter new and existing accounts.

Create a Dynamic Distribution List:

To create a Dynamic Distribution List you need to use CreateDynamicDistributionList (cddl) with the following syntax:

zmprov createDynamicDistributionList all@yourdomain.com memberURL 'ldap:///??sub?(objectClass=zimbraAccount)' zimbraIsACLGroup FALSE

Example:

zmprov createDynamicDistributionList all@example.com memberURL 'ldap:///??sub?(&(zimbraMailDeliveryAddress=*@example.com)(objectClass=zimbraAccount)(!(zimbraIsSystemResource=TRUE))(!(zimbraIsSystemAccount=TRUE))(!(zimbraAccountStatus=closed)))' zimbraIsACLGroup FALSE

Modify a Dynamic Distribution List:

To modify a Dynamic Distribution List you need to use ModifyDistributionList (mdl) with the following syntax:

zmprov ModifyDistributionList yourDynamicList@yourdomain.com memberURL 'ldap:///??sub?(objectClass=zimbraAccount)'

You may want to modify a Dynamic Distribution List to include users from a specific COS, then the command to type will change to this one:

zmprov ModifyDistributionList yourDynamicList@yourdomain.com memberURL 'ldap:///??sub?(&(objectClass=zimbraAccount)(!(zimbraIsSystemResource=TRUE))(!(zimbraIsSystemAccount=TRUE))(!(zimbraAccountStatus=closed))(zimbraCOSId=53b3ab9e-f414-4eb7-bd98-393b62de15d3))' 2


As the filter of a DL is modified, users are both added and/or removed from the DL.

Download Zextras Suite for Zimbra OSE

Post your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Zimbra CLI Commands: Logs | Zimbra
Zimbra OSE Backup on External Storage with Zextras | Zimbra