I want to get a list of all the email accounts on my server

drcoco

Registered
Jun 17, 2005
1
0
151
Guys,

First of all I want to thank you in advance for any help that could be provided to this issue/question.

We recently moved our offices, so we want to send an email to all of our email accounts in the server, letting them know the new location of our offices, as well as inform them about some improvements and changes performed in our company.

Is there a way to get a list of all email accounts created on the hosting server? We currently manage the server ourselves, so anything that would be required to do, whereas starting a sessions in the server with the root user or something to that matter, can be completely done.

Please let me know if there's any way to get this done, for that would greatly help us.

Thanks again,

Francisco
 

jpetersen

Well-Known Member
Dec 31, 2006
113
4
168
As root:

find /home/*/.contactemail | xargs strings | sort -u

Caveats:

* If a user doesn't have their contact email set in their cPanel, .contactemail will be empty.

* This doesn't grab email addresses for non default accounts.
 

madaboutlinux

Well-Known Member
Jan 24, 2005
1,051
2
168
Earth
Guys,

We recently moved our offices, so we want to send an email to all of our email accounts in the server, letting them know the new location of our offices, as well as inform them about some improvements and changes performed in our company.

Is there a way to get a list of all email accounts created on the hosting server?
Francisco
You can email all the clients on your server from WHM >> Account Functions >> "Email all Users" option. Refer the URL: http://cpanel.net/docs/whm/Email_All_Users.htm
 

oderland

Well-Known Member
PartnerNOC
Dec 30, 2002
103
0
166
Kungsbacka, Sweden
Someone that have a clue how to get all this info on a csv file:
contactemail , all domains on account or default domain, package type
Used part of other scripts here to solve it .

Code:
for i in `awk -F: '/home/ {print $1};' /etc/passwd`
do
email=`cat /home/$i/.contactemail`
domain=`cat /var/cpanel/users/$i |grep DNS=`
plan=`cat /var/cpanel/users/$i |grep PLAN=`
if test -n "$email"; then
echo $email, $domain, $plan  >> list.txt
fi
done
It's only takes default domain but that was enough for me this time.