Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Export emails from database

GermontGermont New
edited November 2017 in Vanilla 2.0 - 2.3


Is there an easy way to export the user emails for a monthly newsletter. The forum uses Vanilla 2.3.1
I am especially trying to avoid banned/disabled users, as many of them would mark the email as spam.

Thank you!


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    With "disabled" you mean "deleted"? You can get the mails directly per SQL:

    SELECT Email
    FROM GDN_User
    WHERE Banned = 0
    AND Deleted = 0

    Or you can write a tiny little plugin which uses the query builder. It must create an endpoint and should look similar to that:

        public function pluginController_exportMails_create($sender) {
            $mails = Gdn::sql()
                    'Deleted' => 0,
                    'Banned' => 0
            print_r(array_column($mails, 'Email'));
  • have you looked at the mailchimp plugin? you could use that as a guide

    grep is your friend.

  • GermontGermont New
    edited November 2017

    The owner need it for his shop, there is already a newsletter with html pattern and everything.
    There are still emails with Awaiting mail confirmation.
    But I even removed automatically with Notepad++ the lines with spamshit words.
    Thank you for great support ;)

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Check if adding "AND Confirmed = 1" to the conditions in the sql clause will give you "final" results.

Sign In or Register to comment.