{"id":3008,"date":"2024-06-23T21:12:58","date_gmt":"2024-06-23T15:42:58","guid":{"rendered":"https:\/\/www.nettigritty.com\/kb\/?p=3008"},"modified":"2024-06-23T21:42:33","modified_gmt":"2024-06-23T16:12:33","slug":"how-to-export-all-email-addresses-and-forwarders-created-in-cpanel","status":"publish","type":"post","link":"https:\/\/www.nettigritty.com\/kb\/cpanel\/how-to-export-all-email-addresses-and-forwarders-created-in-cpanel\/","title":{"rendered":"How to export all email addresses and forwarders created in cPanel"},"content":{"rendered":"<p>The commands mentioned below need to be run either from SSH or Terminal (in WHM).<\/p>\n<p>To export all all forwarders, run the command below.<\/p>\n<p><code>cat \/etc\/valiases\/* &gt; \/home\/forwarders.txt<\/code><\/p>\n<p>This will create a list of forwarders and place them at \/home\/forwarders.txt. Now, we can open this file using <code>vi<\/code> or <code>nano<\/code> or email it to ourselves using the command below.<\/p>\n<p><code>mail -s 'list of forwarders' you@yourdomain.com &lt; \/home\/forwarders.txt<\/code><\/p>\n<p>To clean up, you can now delete the file \/home\/forwarders.txt by using the command below<\/p>\n<p><code>rm \/home\/forwarders.txt<\/code><\/p>\n<p>Next, to export all email addresses created in cPanel, run the command below:<\/p>\n<p><code>cat \/etc\/userdomains | sed \"s\/:\/\/g\" | awk {'system(\"ls -1d \/home\/\"$2\"\/mail\/\"$1\"\/* 2&gt; \/dev\/null\")'} | sed \"s\/\\\/\/ \/g\" | awk {'print $5\"@\"$4'} &gt; \/home\/emailaddresses.txt<\/code><\/p>\n<p>This will create a list of all email addresses and place them at \/home\/emailaddresses.txt. Now, we can open this file using <code>vi<\/code> or <code>nano<\/code> or email it to ourselves using the command below.<\/p>\n<p><code>mail -s 'list of email addresses' you@yourdomain.com &lt; \/home\/emailaddresses.txt<\/code><\/p>\n<p>You can now delete the file \/home\/emailaddresses.txt by using the command below<\/p>\n<p><code>rm \/home\/emailaddresses.txt<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The commands mentioned below need to be run either from SSH or Terminal (in WHM). To export all all forwarders, run the command below. cat \/etc\/valiases\/* &gt; \/home\/forwarders.txt This will create a list of forwarders and place them at \/home\/forwarders.txt. Now, we can open this file using vi or nano or email it to ourselves [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2],"tags":[],"class_list":["post-3008","post","type-post","status-publish","format-standard","hentry","category-cpanel","category-mail"],"_links":{"self":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts\/3008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/comments?post=3008"}],"version-history":[{"count":6,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts\/3008\/revisions"}],"predecessor-version":[{"id":3014,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/posts\/3008\/revisions\/3014"}],"wp:attachment":[{"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/media?parent=3008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/categories?post=3008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nettigritty.com\/kb\/wp-json\/wp\/v2\/tags?post=3008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}