The following command will list all the email accounts on a server:
for i in $(awk '{print $2}' /etc/trueuserdomains); do uapi --user=$i Email list_pops | egrep "\s+email:" ; done
This command might come in handy in case you want to ensure if an email account is hosted on the server or not. The output of the command will show the default email accounts simply with the account name and without the @domain.tld section and will show the non-default email accounts in full, with the @domain.tld part. Here is a sample output:
for i in $(awk '{print $2}' /etc/trueuserdomains); do uapi --user=$i Email list_pops | egrep "\s+email:" ; done
email: cptest2@cptest.tld
email: cptest
email: mytestcp
Of course, if there are hundreds or thousands of email accounts on the server then the output would be much longer and it will take the command longer to execute.
Comments
0 comments
Article is closed for comments.