Any way to read out Email addresses?

edited July 2007 in Vanilla 1.0 Help
What I want to do: Read out all the email addresses of subscribers in my vanilla forum. Best would be be to have them automatically saved in a text file. I know there used to be a plugin somewhere that does that but I never got it to work and it hasnt been updated for a long time. Right now I copy new subscribers one by one into a file but with about 10 new subscribers each day it gets a bit of a hassle. Any way to do this?

Comments

  • ithcyithcy New
    edited July 2007
    copy and paste the following code into a blank file with a text editor. save it as getemails.php and upload it to your vanilla folder.
    then go to http://yoursite.com/path-to-your-vanilla/getemails.php in your browser. you'll get either a plain text file with the list of emails, or a csv file with usernames and emails, depending on how you set $emails_only in the code below.

    <?php //getemails.php - ithcy 07-07-07 //put this file in the root of your vanilla forum //change the following value to false to get a csv file with usernames and emails, instead of just a list of emails $emails_only = true; // change the following value to true to get "windows-friendly" output $windows_linebreaks = false; //don't change anything below here $Configuration = $DatabaseTables = $DatabaseColumns = array(); $output = ""; $br = ($windows_linebreaks) ? "\r\n" : "\n"; require("./conf/database.php"); require("./appg/database.php"); $conn = mysql_connect($Configuration['DATABASE_HOST'],$Configuration['DATABASE_USER'],$Configuration['DATABASE_PASSWORD']) or die(mysql_error()); mysql_select_db($Configuration['DATABASE_NAME'], $conn) or die(mysql_error()); if ($emails_only) { $sql = "select Email as line from LUM_User order by Name"; $filename = "emails.txt"; $mimetype = "text/plain"; } else { $sql = "select concat('\"', Name, '\",\"', FirstName, ' ', LastName, '\",\"', Email, '\"') as line from LUM_User order by Name"; $filename = "emails.csv"; $mimetype = "text/csv"; } $result = mysql_query($sql, $conn) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $output .= $row['line'] . $br; } mysql_close($conn); $size = strlen($output); header("Content-Type:{$mimetype}"); header("Content-Disposition: attachment; filename={$filename}; size={$size}"); print $output; exit; ?>
  • oh, and delete it when you're done.
This discussion has been closed.