{"id":1089,"date":"2018-06-19T15:59:31","date_gmt":"2018-06-19T15:59:31","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=article&#038;p=1089"},"modified":"2022-06-22T09:58:54","modified_gmt":"2022-06-22T09:58:54","slug":"how-to-bulk-update-change-contact-email-for-accounts-in-whm","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/how-to-bulk-update-change-contact-email-for-accounts-in-whm\/","title":{"rendered":"How to Bulk Update\/Change Contact Email for accounts in WHM"},"content":{"rendered":"<p>In this tutorial, you will learn how to bulk update\/change Contact Email for accounts in WHM. This is useful when you have a reseller and want to change the default email address on all of the accounts with a different email address.<\/p>\n<p>If you&#8217;re not feeling comfortable using the command line interface, we recommend you to do it manually in WHM.<\/p>\n<p>To do so,\u00a0 navigate to <strong><em>Account Information<\/em><\/strong> &gt;&gt; <strong><em>List Accounts<\/em><\/strong> area. Here you will see all the accounts listed. Then click on the <strong><em>&#8216;+&#8217;<\/em><\/strong> sign in front of the username then change the contact email for the account(s) that you want.<\/p>\n<p>In case you prefer doing it for a single or few accounts from the command line, you can use:<\/p>\n<pre>cpapi2 --user=user CustInfo savecontactinfo email=john@smith.com<\/pre>\n<h3 id=\"how-to-bulk-update-change-contact-email-for-accounts-in-whm\">How to Bulk Update\/Change Contact Email for accounts in WHM<\/h3>\n    \t\t<div class=\"hts-messages hts-messages--alert   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tFor the following steps, you&#8217;ll require root access to your server    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p>The contact email address for each cPanel account is stored in two different files:<\/p>\n<ul>\n<li><strong>\/var\/cpanel\/users\/user<\/strong><\/li>\n<li><strong>\/home\/user\/.contactemail<\/strong><\/li>\n<\/ul>\n<p>Let&#8217;s say that you need to change an existing contact email: john@smith.com and to replace it for all the cPanel accounts with smith@john.com.<\/p>\n<p class=\"p1\"><b>Tired of hassling with hosting management?<span class=\"Apple-converted-space\">\u00a0 <\/span>ChemiCloud is the managed hosting solution designed to save you time and money! <\/b><span class=\"s1\">\ud83e\udd13<\/span><b> Check out our <\/b><a href=\"https:\/\/chemicloud.com\/pricing#60b65e4e63b58\" target=\"_blank\" rel=\"noopener\"><span class=\"s2\"><b>web hosting<\/b><\/span><\/a><b> plans!<\/b><\/p>\n<p>While you are in your terminal, connected to your server, browse to\u00a0\/var\/cpanel\/users\/:<\/p>\n<pre>cd \/var\/cpanel\/users\/<\/pre>\n<p>And do a grep for &#8220;john@smith.com&#8221; in each file:<\/p>\n<pre>grep -irl \"john@smith.com\" .<\/pre>\n<p>It will start listing the files that have a match for the search term. E.g:<\/p>\n<pre>.\/user1\r\n.\/user2\r\n.\/user3<\/pre>\n<p>Now you will have to create a text file in\u00a0\/var\/cpanel\/users\/ e.g: users.txt and to add the results of your search using grep command.<\/p>\n<p>Next, we&#8217;ll use sed to replace all the instances matching\u00a0john@smith.com with smith@john.com. The command line is:<\/p>\n<pre>for i in $(cat users.txt); do sed -i 's\/john@smith.com\/smith@john.com\/g' $i; done<\/pre>\n<p>The same steps will need to be applied to do the bulk change of the email stored in \/home\/user\/.contactemail.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to bulk update\/change Contact Email for accounts in WHM. This is useful when you have a reseller and want to change the default email address on all of the accounts with a different email address. If you&#8217;re not feeling comfortable using the command&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[174],"ht-kb-tag":[],"class_list":["post-1089","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-whm"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/1089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=1089"}],"version-history":[{"count":6,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/1089\/revisions"}],"predecessor-version":[{"id":7436,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/1089\/revisions\/7436"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=1089"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=1089"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=1089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}