It is possible to add custom lookups into Zimbra's postfix - but one has to be very careful because during ugprade some stuff might suddenly disappear.
To idea was just to add new virtual_alias_maps into main.cf, so that I could use my other LDAP server, that keeps accounts and Samba stuff as a base for dynamic/group based distribution lists.
In /opt/zimbra/conf create files you will use for lookup. I did create ldap-static.cf and ldap-dyn.cf. Inside you put all the postfix-ldap directives. In my case these are:
Code:
server_host = ldap://example.com
search_base = ou=Groups,dc=example,dc=com
query_filter = (&(objectClass=posixGroup)(displayName=%s))
result_attribute = memberUid
domain = example.com
version = 3
bind = no
Lines above are for static groups (i.e. system groups are also distribution lists).
And for dynamic stuff, where you do some more sophisticated magic:
Code:
server_host = ldap://example.com
search_base = o=Email,dc=example,dc=com
query_filter = (l=%s)
special_result_attribute = description
result_attribute = mail
bind = no
The "description" attribute contains the LDAP query that will be used to match the users. "result_attribute" says which attribute contains the valid e-mail address. The query can look like this:
Code:
ldap://example.com/ou=Users,dc=example,dc=com?title,mail?sub?(title=CrazyPeople)
Which means, that e-mail will be sent to all people having the title attribute 'CrazyPeople' (which is a multi-value field, thus you can really do a lot of magic with them).
Once we have that we need to tell postfix to use our lookups. To do so edit the file /opt/zimbra/conf/zmmta.cf and substitute the following line:
Code:
POSTCONF virtual_alias_maps LOCAL virtual_alias_maps
into
Code:
POSTCONF virtual_alias_maps ldap:/opt/zimbra/conf/ldap-static.cf,ldap:/opt/zimbra/conf/ldap-dyn.cf,ldap:/opt/zimbra/conf/ldap-vmm.cf
You are done. Now just:
Code:
su - c zimbra
postfix reload
and you can start spamming your old friends 
This way you can create your own distribution lists and use full power of the system data, like groups or titles. Probably you can do similar things directly in Zimbra, but I am using account provisioning for Zimbra with external LDAP auth and I do need these mail distribution lists, since they require nearly no maintenance.
If anybody knows how to do such thing IN Zimbra - I would love to hear more about the solution.