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 hosted email addresses

Discussion in 'E-mail Discussion' started by John Schmerold, May 1, 2014.

  1. John Schmerold

    John Schmerold Well-Known Member

    Joined:
    Apr 21, 2004
    Messages:
    64
    Likes Received:
    4
    Trophy Points:
    158
    Location:
    st. louis
    cPanel Access Level:
    Root Administrator
    This four liner produces a list of your email addresses, it is helpful if you are using an external spam filter

    #!/bin/bash

    find /etc/valiases/* -type f | xargs -ifile sed -e 's/:.*//' file > /usr/src/getAllEmail.txt

    ls -d /home/*/mail/*/*/ | awk 'BEGIN { ; } ; { ; tcmd = "test -d " $1 ; if(!system(tcmd)){ ; split($1,MyArray,"/") ; print MyArray[6] "@" MyArray[5] ; } ; }' >> /usr/src/getAllEmail.txt

    sed -i -e 's/*.*//' /usr/src/getAllEmail.txt
    sed -i '/^\s*$/d' /usr/src/getAllEmail.txt

    Hope this helps someone.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,400
    Likes Received:
    1,952
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Thank you for sharing this script. Please note that user-submitted scripts are not tested or supported by cPanel. We encourage everyone to review all aspects of this script before using it on a production server.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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