Skip to main content

List of all Emails on a Domain?

Comments

3 comments

  • cPanelLauren
    Hi @ca2336 Do you mean all the email accounts or all of the emails period? For the first one you can easily get a list of email accounts by running something like UAPI Functions - Email::list_pops - Developer Documentation - cPanel Documentation to get a list of all the email accounts associated with that user. uapi --user=$user Email list_pops regex=domain.tld
    0
  • PossibleTechAssistance
    There are some locations like : /home/$user/mail/$domain.com/
    -- Which would show the email users that are tied to the domain that the directory is for. As well you can use the uapi that @cPanelLauren has posted, and if you are more technically inclined you can use some regex to clean up the output # uapi Email list_pops regex=[\S+@\S+] | grep -oP '(?<=email:[[:space:]]).+@\w+.\S+' user@domain.com user1@domain.com user2@domain.com user3@domain.com
    Which only provides the email accounts that are tied to the cPanel account and doesn't output the other pieces of information that would normally come out of using the uapi.
    0
  • cPMarkF
    You could also list all email accounts for every cPanel user using a bash for loop and uapi call: # cd /var/cpanel/users; for i in $(find * -type f \! -name system); do uapi --user="$i" Email list_pops regex="$i" | grep email; done;
    0

Please sign in to leave a comment.