How do I get a list of mailboxes across the entire server, domain, or with a filter?

Preferably with details - for example, quota, occupied space, aliases and others that are stored with the mailbox

    Have something to say?

    Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

    heavygale

    is it possible to make it readable, for example, tabular?

    is it possible to make a selection of only the specified parameters, for example: mailbox, full name, quota, current mailbox size?

    Yes, just write a little script to generate the file you need.
    Or browse the json manually with something like jless.
    After all, it’s an API, an Application Programming Interface.

      a month later

      heavygale

      I found several ways to snag addresses.

      In general, you can only upload a list of all server addresses - through the api, you can specify the values of all or a specific mailbox in getmailboxes.

      Then excel, python or online services come to the rescue that can make a list of email addresses from an array.

      Tell me how to make a restriction on the list of those who can write to the mailbox or alias?

      4 days later

      copy paste from admin webUI to excel …
      😆

      You can also use this command from inside your dovecot container:

      doveadm mailbox status -A -t vsize '*'

      Quota:

      doveadm quota get -A | grep STORAGE

      10 days later
      • Bbjoern

          Moolevel 0

        leksand
        Hi all,
        I’ve put my coins together in a bash script. Didn’t want to come into this again :-)

        Dependencies:

        • csvkit ( apt install csvkit curl)
        • curl
        • conf: .env.moo file:
          export XAPIKey=xxx-yyy-zzz
          export cowserver=moo.mydomain.eu
        • api key from Admin-Web-UI (Read-only is OK)

        moo-dump-api.sh:

         #!/usr/bin/env bash
        # Liest Domains, Postfächer und Aliases vom Server aus. 
        # in der .env.moo Datei liegen die Zugangsdaten und Servernamen
        # Benötigte tools:
        #  - jq # nicht zwingend hierfür aber generell super
        #  - csvkit # für csvformat und in2csv
        #  - curl # als WEB Tool für den API call
        #
        # Benötigte Conf:
        #  - API Key vom mailcow- WebUI als admin
        #
        # curl --header "Content-Type: application/json" --header "X-API-Key: $XAPIKey" https://${cowserver}/api/v1/get/alias/all
        # ### nicht so schön für CSV: ### jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv'
        # in2csv DMPJSONCVY | csvformat -D \; -U0
        #
        # # BEISPIEL .env.moo File:
        # export XAPIKey=xxx-yyy-zzz
        # export cowserver=moo.mydomain.eu
        
        ENVFILE=.env.moo
        source $ENVFILE
        
        DOMAINSFILE=DUMP_${cowserver}_domains.csv
        BOXESFILE=DUMP_${cowserver}_mailboxes.csv
        ALIASESFILE=DUMP_${cowserver}_mailaliases.csv
        ALIASDOMAINSFILE=DUMP_${cowserver}_domainaliases.csv
        
        DOMAINSTEMP=$(mktemp -p . -t DMPJSONXXX)
        BOXESTEMP=$(mktemp -p . -t DMPJSONXXX)
        ALIASESTEMP=$(mktemp -p . -t DMPJSONXXX)
        ALIASDOMAINSTEMP=$(mktemp -p . -t DMPJSONXXX)
        
        curl --header "Content-Type: application/json" --header "X-API-Key: $XAPIKey" https://${cowserver}/api/v1/get/domain/all > $DOMAINSTEMP
        curl --header "Content-Type: application/json" --header "X-API-Key: $XAPIKey" https://${cowserver}/api/v1/get/mailbox/all > $BOXESTEMP
        curl --header "Content-Type: application/json" --header "X-API-Key: $XAPIKey" https://${cowserver}/api/v1/get/alias/all > $ALIASESTEMP
        curl --header "Content-Type: application/json" --header "X-API-Key: $XAPIKey" https://${cowserver}/api/v1/get/alias-domain/all > $ALIASDOMAINSTEMP
        
        in2csv --format=json $DOMAINSTEMP | csvformat -D \; -U0 > $DOMAINSFILE
        in2csv --format=json $BOXESTEMP | csvformat -D \; -U0 > $BOXESFILE
        in2csv --format=json $ALIASESTEMP | csvformat -D \; -U0 > $ALIASESFILE
        in2csv --format=json $ALIASDOMAINSTEMP | csvformat -D \; -U0 > $ALIASDOMAINSFILE
        
        rm $DOMAINSTEMP $BOXESTEMP $ALIASESTEMP $ALIASDOMAINSTEMP

          bjoern

          Thanks!

          Do you have a way to make a restriction so that only addresses from the list of addresses and/or domains can be written to certain addresses or aliases?

          No one is typing