The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Export list of all email addresses

Discussion in 'E-mail Discussions' started by John Schmerold, Jun 25, 2013.

  1. John Schmerold

    John Schmerold Active Member

    Joined:
    Apr 21, 2004
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    st. louis
    cPanel Access Level:
    Root Administrator
    I have configured an external spam filter using Exim. Things are working well, except for for the backscatter caused by not incorporating a list of valid email addresses into the filter's configuration.

    How can I get a list of all valid email addresses on my cPanel box?
     
  2. stdout

    stdout Well-Known Member

    Joined:
    Apr 10, 2003
    Messages:
    189
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Nelspruit, Mpumalanga, South Africa
    cPanel Access Level:
    Root Administrator
    The most direct way I can think of (and yes, I do have a bit of a caveman mentality) is this:

    Code:
    cat /etc/userdomains | sed "s/://g" | awk {'system("ls -1d /home/"$2"/mail/"$1"/* 2> /dev/null")'} | sed "s/\// /g" | awk {'print $5"@"$4'}
    The above command will print our every email address in the server.
    * Don't forget you'll want the email aliases aswell (found under /etc/valiases/).
     
    ctrlshosting likes this.
  3. John Schmerold

    John Schmerold Active Member

    Joined:
    Apr 21, 2004
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    st. louis
    cPanel Access Level:
    Root Administrator
    Thank you for the nice solution.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page