Hi Is there a file on the server that keeps a list of all emails for the domain?
C ca2236 Well-Known Member Feb 2, 2018 244 25 28 Nebraska cPanel Access Level DataCenter Provider Apr 11, 2019 #1 Hi Is there a file on the server that keeps a list of all emails for the domain?
cPanelLauren Product Owner II Staff member Nov 14, 2017 13,265 1,297 363 Houston Apr 12, 2019 #2 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. Code: uapi --user=$user Email list_pops regex=domain.tld
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. Code: uapi --user=$user Email list_pops regex=domain.tld
P PossibleTechAssistance Registered Apr 12, 2019 1 0 1 Houston, Texas cPanel Access Level Root Administrator Apr 12, 2019 #3 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.
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 May 22, 2019 #4 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; Reactions: cPanelMichael and cPanelLauren
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;