Working up to a Zimbra migration...

I would like to keep my mail gateway as the primary relay smarthost for zimbra and other domains in use. The gateway runs postifx.

I figure in addition to static maps for other domains, I can point the gateway's relay_recipient_maps at LDAP on the Zimbra server for a dynamic map. Or I could regularly export all valid recipients on the zimbra machine and place it in a map on the gateway.

I think the export is probably the way to go. It would allow the Zimbra server to go down without bouncing any mails.

It looks like the config for such a map is fortunately in /opt/zimbra/conf/ldap-vam.cf

Code:
server_host = ldap://a.host.name:389
server_port = 389
search_base =
query_filter = (&(|(zimbraMailDeliveryAddress=%s)(zimbraMailAlias=%s)(zimbraMailCatchAllAddress=%s))(zimbraMailStatus=enabled))
result_attribute = zimbraMailDeliveryAddress,zimbraMailForwardingAddress,zimbraPrefMailForwardingAddress,zimbraMailCatchAllForwardingAddress
version = 3
bind = no
timeout = 30

Which for my gateway would look something like
Code:
relay_recipient_maps = 
  ldap:$config_directory/relay_recipients.zimbra.cf
  hash:$config_directory/relay_recipients.sub.domain
  hash:$config_directory/relay_recipients.other.sub.domain
But to do a full recipient extract, is the following the best way to do that?

ldapsearch -H 'ldap://a.host.name/' -x '(&(|(zimbraMailDeliveryAddress=*)(zimbraMailAlias =*)(zimbraMailCatchAllAddress=*))(zimbraMailStatus =enabled))'