Generate a list 📋 of all ✉️ email accounts on cPanel / WHM server

Generate a list 📋 of all ✉️ email accounts on cPanel / WHM server

The following script will go through all your cPanel users and their domains, and print on the terminal a list of all current email accounts.

cat /etc/userdomains | sed "s/://g" | awk {'system("ls -1d /home/"$2"/mail/"$1"/* 2> /dev/null")'} | sed "s/\// /g" | awk {'print $5"@"$4'}
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.