Question:
How can I export my mailing list?
Answer:
Make a template with this code:
{exp:query sql="select email from exp_mailing_list where list_id = '2' order by email asc"}
{email}<br />
{/exp:query}
Use your list_id to match the list you want to export.
View the rendered source of your template in your web browser and save the output as a CSV file. You should now be able to view your mailing list in Excel or import it into web applications such as Campaign Monitor.
Alternatively if you would rather have the browser prompt you to download a CSV file then allow PHP for the template and use the following code:
<?php
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="mailing-list.csv"');
?>
{exp:query sql="select email from exp_mailing_list where list_id = '2' order by email asc"}
{email}{/exp:query}
Best Practice: Protect this code snippet from others by modifying the templates access restrictions to prevent access by anyone other than SuperAdmins. You don’t want Google to index this page!
Category:Mailing List Category:Exporting
