Export list of all email addresses

John Schmerold

Well-Known Member
Apr 21, 2004
77
5
158
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?
 

stdout

Well-Known Member
Apr 10, 2003
189
6
168
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/).
 
  • Like
Reactions: ctrlshosting