Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

List of all Emails on a Domain?

Discussion in 'E-mail Discussion' started by ca2236, Apr 11, 2019.

  1. ca2236

    ca2236 Well-Known Member

    Joined:
    Feb 2, 2018
    Messages:
    96
    Likes Received:
    12
    Trophy Points:
    8
    Location:
    Nebraska
    cPanel Access Level:
    DataCenter Provider
    Hi

    Is there a file on the server that keeps a list of all emails for the domain?
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,442
    Likes Received:
    503
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. PossibleTechAssistance

    PossibleTechAssistance Registered

    Joined:
    Apr 12, 2019
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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.
     
  4. cPMarkF

    cPMarkF *nix Technical Analyst Staff Member

    Joined:
    Feb 4, 2013
    Messages:
    17
    Likes Received:
    8
    Trophy Points:
    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;
     
    cPanelMichael and cPanelLauren like this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice