{"id":29,"date":"2016-12-13T20:08:40","date_gmt":"2016-12-13T20:08:40","guid":{"rendered":"https:\/\/ramblings.gregconway.com\/?p=29"},"modified":"2017-01-02T18:29:24","modified_gmt":"2017-01-02T18:29:24","slug":"plesk-extract-all-email-addresses-from-database","status":"publish","type":"post","link":"https:\/\/ramblings.gregconway.com\/?p=29","title":{"rendered":"Plesk &#8211; extract all email addresses from database"},"content":{"rendered":"<p>I recently needed to email everybody on my Plesk server. Traditionally I&#8217;ve done this by maintaining an &#8220;all@domain.com&#8221; list for each subscription but of course that requires constant maintenance.<\/p>\n<p>So instead I did a bit of searching, amended what I found (on the plesk forum I believe), and came up with this (which requires ssh access) &#8211;<\/p>\n<pre># log into mysql\r\nmysql -uadmin -p`cat \/etc\/psa\/.psa.shadow`\r\n\r\n# Once logged into mysql \r\nuse psa;\r\nselect concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address INTO OUTFILE '\/tmp\/emailaddresses.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\\n';\r\nexit\r\n\r\n# This will create a file \/tmp\/<span id=\"applicationAdminPasswordText\">emailaddresses.csv, which you can email yourself as follows\r\n<\/span><span id=\"applicationAdminPasswordText\">mail me@domain.com &lt; \/tmp\/emailaddresses.csv\r\n\r\n# and then delete the source file for good measure!\r\nrm \/tmp\/emailaddresses.csv -f<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently needed to email everybody on my Plesk server. Traditionally I&#8217;ve done this by maintaining an &#8220;all@domain.com&#8221; list for each subscription but of course that requires constant maintenance. So instead I did a bit of searching, amended what I &hellip; <a href=\"https:\/\/ramblings.gregconway.com\/?p=29\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-plesk"],"_links":{"self":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":2,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":32,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions\/32"}],"wp:attachment":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}