habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

cPanel Get All Email Address and Mail Forwarder

46 sec read

Get All Email Address and Mail Forwarder in cPanel

Hi Dude. I want to share tips on how to get all email address and mail forwarder in cPanel. This is simple method to export all email addresses on all cpanel accounts. Just run one line of the program, you can immediately display all cpanel email addresses.

Execute Simply Command to Get All Email Address

root@server# cat /etc/userdomains | sed "s/://g" | awk {'system("ls -1d /home/"$2"/mail/"$1"/* 2> /dev/null")'} | sed "s/\// /g" | awk {'print $5"@"$4'}

Yes, our mail address will show.

Dump File Exported List

Or we can dump to file, and then send mail with attachment that file via command line linux.

root#server# cat /etc/userdomains | sed "s/://g" | awk {'system("ls -1d /home/"$2"/mail/"$1"/* 2> /dev/null")'} | sed "s/\// /g" | awk {'print $5"@"$4'} > /srv/190722emailaddress.txt

Send Mail With Attachment via Command Line

root@server# mail -a /srv/190722emailaddress.txt -s 'email address190722' [email protected]


###type text here###
This is body mail.
.     
EOT

Secondly, if we want to show all mail forwarders is under /etc/valiases/. We can use favourite editor like vim or nano to edit it.

source: https://forums.cpanel.net/threads/export-list-of-all-email-addresses.351951/


Let's Buy Me Coffee.

Buy Me a Coffee at ko-fi.com

https://saweria.co/habibzain
https://ko-fi.com/habibzain
See also  Send Email with Command Line Terminal CLI Using Zimbra
habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Centos Failed Update Kernel

Today I did a kernel update on my server with Centos 7 OS. At the end of the update process, I found a kernel...
habibzain
1 min read

Easy Fix Missing mirrorlist http://mirrorlist.centos.org on CentOS 7

When running yum update or command that utilize the yum system, errors similar to the following are produced: If you’re encountering issues with the...
habibzain
1 min read

Easy Create Laravel Project with Composer

Requirement Laravel, a popular PHP framework, is renowned for its elegant syntax and robust features, making it a top choice for web developers. One...
habibzain
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss good article from us, get weekly updates in your inbox