List of Mailboxes in WHM/cPanel
The well-known Plesk stores mailbox records in a mysql database. Meanwhile, you can get a list of mailboxes in WHM cPanel using the following script:
#!/bin/bash
for f in $(ls |grep -v "^\.\|virtfs\|lost+found\|cpeasyapache\|quota.user"); do
f2=$(echo $f |sed 's/\/$//g');
for box in $(ls "$f"/mail/ |grep -v "^\.\|new\|cur\|sent\|tmp" ); do
m=$(ls -l /home/"$f"/mail/"$box"/ |awk '{print $9}' |grep -v "^\." |sed '/^$/d');
if [ "$m" != "" ];then
for m2 in $m;
do
echo "$m2"@"$box"
done;
fi
done;
done;
