Export list of all email addresses

John Schmerold

Well-Known Member
Apr 21, 2004
81
6
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
7
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

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
I am happy to hear this solution worked well for you. I am marking this thread as [Resolved].

Thank you.
 

000

Well-Known Member
Jun 3, 2008
549
30
78
Ey!,

some idea/command to show ALL EMAILS of ONLY "thisdomain.com" ??


Thanks