List of all Emails on a Domain?

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,273
1,282
313
Houston
Apr 12, 2019
1
0
1
Houston, Texas
cPanel Access Level
Root Administrator
There are some locations like :

Code:
/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

Code:
# uapi Email list_pops regex=[\[email protected]\S+] | grep -oP '(?<=email:[[:space:]])[email protected]\w+.\S+' 
[email protected] 
[email protected] 
[email protected] 
[email protected]
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.
 

cPMarkF

*nix Technical Analyst
Staff member
Feb 4, 2013
18
8
78
cPanel Access Level
Root Administrator
You could also list all email accounts for every cPanel user using a bash for loop and uapi call:

Code:
# cd /var/cpanel/users; for i in $(find * -type f \! -name system); do uapi --user="$i" Email list_pops regex="$i" | grep email; done;