Skip to main content

get list of email accounts

Comments

6 comments

  • cPRex Jurassic Moderator
    Hey there! The API call is your best best as there isn't a flat file like what you mentioned. You could see individual accounts with their respective directories in /home/usrename/mail/domain.com, but that's not nearly as pretty of a list of what the API creates.
    0
  • ca2236
    thanks @cPRex
    0
  • cPRex Jurassic Moderator
    Sure thing!
    0
  • aadii786
    for i in $(find /var/cpanel/users -type f | egrep -o '[a-zA-Z0-9]+$' | grep -v system);do whmapi1 list_pops_for user=$i;done this will work to get all email accounts
    1
  • mlopez
    I found this in the api, this can be scripted to cycle through the accounts. uapi --user=account Email list_pops
    was hoping for a flat file like /etc/localdomains or /etc/userdomains (or something like that, or a pre-existing script/command that would run on the whole system without scripting)

    Thank you. I was looking for it, too! So you can also use: whmapi1 list_pops_for user=[username]
    0
  • ThatHostingCo
    for i in $(find /var/cpanel/users -type f | egrep -o '[a-zA-Z0-9]+$' | grep -v system);do whmapi1 list_pops_for user=$i;done this will work to get all email accounts

    just to note that you can print the output of the readout to a file by doing the following: for i in $(find /var/cpanel/users -type f | egrep -o '[a-zA-Z0-9]+$' | grep -v system);do whmapi1 list_pops_for user=$i >> mailservice.txt;done Just change the name for the mailservice.txt to whatever you want the file to be. To note it will print the file to the directory that you are in.
    0

Please sign in to leave a comment.