Results 1 to 4 of 4

Thread: ZMProv command to dump all e-mail addresses

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    23
    Rep Power
    5

    Default ZMProv command to dump all e-mail addresses

    Hi,
    We use a list of all e-mail addresses on our mail filter as the first line against spam. While I usually remember to update that list everytime I add a Zimbra user, I sometimes forget.

    Would there be a zmprov command that can export all e-mail addresses in all the domains, plus the alias addresses, and the distribution list e-mail addresses (not the contents of them).

    Thanks

  2. #2
    Join Date
    Oct 2010
    Posts
    373
    Rep Power
    5

    Default

    Quote Originally Posted by cpaul_carling View Post
    Would there be a zmprov command that can export all e-mail addresses in all the domains, plus the alias addresses, and the distribution list e-mail addresses (not the contents of them).
    Hi paul,

    'su - zimbra' and

    get all email addresses on server - $ zmprov -l gaa
    get all domains on server - $ zmprov -l gad
    get all accounts under a domain - $ zmprov -l gaa domain.com

    All distribution lists on server can be found with $ zmprov gadl
    and if you need details on a DL try this one $ zmprov gdl <DLname>

    Aliases can be found by looking into 'zimbraMailAlias' field of each mail address.
    su - zimbra
    $ zmprov ga account@domain.com zimbraMailAlias

    now search alias of each accounts on server with a loop
    $ for i in `zmprov -l gaa` ; do zmprov ga $i zimbraMailAlias ; done (this will take a while, if an account doesn't have any alias set it the particular result will be blank. Just write the results to a file if the list is too long)

    Check '$ zmprov help account' for various switches.

  3. #3
    Join Date
    Feb 2009
    Location
    Winter Springs, FL
    Posts
    3
    Rep Power
    6

    Default

    Hey all, I wrote a script that dumps all of the primary email addresses, aliases, and distribution lists in a small efficient shell script. I thought I'd share it here so I don't lose it.

    Code:
    #!/bin/bash
    
    set -o nounset   # exit on unset variables
    set -o errexit   # exit if command exits with non-zero value
    
    if [ "$(whoami)" != "zimbra" ]; then
      echo "This script must be run as the zimbra user."
      exit 1
    fi
    
    RESULTS=( $(zmprov -l gaa -v | grep -E "zimbraMailAlias|zimbraMailDeliveryAddress" ) )
    EMAILS=( ${RESULTS[@]/zimbraMail*/} )
    for EMAIL in "${EMAILS[@]}"; do
      echo "$EMAIL"
    done
    zmprov gadl
    Any improvements are welcome. Use it however you like and at your own risk.
    Last edited by tomparker.net; 12-28-2012 at 10:28 AM.

  4. #4
    Join Date
    Sep 2007
    Posts
    37
    Rep Power
    8

    Default

    I realize this is an old thread but is there a way to generate listings like what's found in the admin console which lists aliases along with their associated Zimbra accounts? The script above is wonderful but the output is a linear list with no linkages between an alias and what it points to.

    Thanks in advance.

Similar Threads

  1. Replies: 8
    Last Post: 04-10-2011, 10:14 AM
  2. Replies: 7
    Last Post: 02-03-2011, 07:01 AM
  3. Problem with Postfix and MTA
    By ZMilton in forum Administrators
    Replies: 16
    Last Post: 04-16-2008, 07:47 AM
  4. [SOLVED] Mailserver down when send file attach of 50Mb
    By ZMilton in forum Administrators
    Replies: 20
    Last Post: 04-10-2008, 12:44 PM
  5. fresh install down may be due to tomcat
    By gon in forum Installation
    Replies: 10
    Last Post: 07-25-2007, 09:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •