wordpress tip: extract all comment emails for mailing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55679

    #1

    wordpress tip: extract all comment emails for mailing

    I dont recommend spamming your blog users, but sometimes you may want to send information to your readers, many of you might use a wordpress plugin for a mailing list or an external program which can import a list.

    Here is a small snippet of code which will print out all your comment author's emails.

    Code:
    <?php
    
    $db_host = "localhost";
    $db_user = "username";
    $db_password = "password";
    $db_name = "database";
    
    $connect=mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
    $db=mysql_select_db($db_name, $connect) or die(mysql_error());
    
    $result=mysql_query("select comment_author_email from wp_comments");
    while($row=@mysql_fetch_assoc($result))
    {
            $email=$row[comment_author_email];
            echo $email;
    }
    
    ?>
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.
  • 2012
    So Fucking What
    • Jul 2006
    • 17189

    #2
    best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

    Comment

    • Donfoolio
      Confirmed User
      • Mar 2006
      • 963

      #3
      Nice thank you!
      Promote SipSap escort search

      ICQ: 227853047

      Comment

      • Ethersync
        Confirmed User
        • Mar 2008
        • 5289

        #4
        Another excellent tip from our resident WordPress guru
        The best ePassporte replacement I have found: OKPAY

        Comment

        • Si
          Such Fun!
          • Feb 2008
          • 13900

          #5

          Comment

          • Sosa
            In Tushy Land
            • Oct 2002
            • 40149

            #6
            good stuff fris

            Comment

            • camgirlshide
              Confirmed User
              • Jan 2005
              • 1558

              #7
              Did you put a message on the site that says leaving a comment signs you up for a mailing list and have some opt out method?
              Useful adult webmaster links -
              Alphabetical list of solo models with webcam
              Stats on my best converting affiliate programs - camgirlshide webmaster blog
              complete list of affiliate programs I use.

              Comment

              • papill0n
                Unregistered Abuser
                • Oct 2007
                • 15547

                #8
                nice fris

                Comment

                • st0ned
                  Confirmed User
                  • Mar 2007
                  • 8437

                  #9
                  Another great thread from fris! You are on a roll lately, hit me up sometime lets do some biz.
                  Conversion Sharks - 1,000+ adult dating offers, traffic management, and consistently high payouts.
                  We will guarantee and beat your current EPC to win your dating traffic!
                  Skype: ConversionSharks || Email: info /@/ conversionsharks.com

                  Comment

                  • BigBen
                    Confirmed User
                    • Nov 2004
                    • 2299

                    #10
                    Quality posts lately.

                    Here's another way using built-in WP functions so you don't have to mess with the mysql stuff (tested in 2.7):

                    Code:
                    <?php
                    require_once('example.com/wp-load.php');
                    
                    $email_list = $wpdb->get_results("SELECT DISTINCT comment_author_email FROM $wpdb->comments WHERE comment_author_email != ''");
                    foreach($email_list as $email) {
                            echo $email->comment_author_email . "\n";
                    }

                    Comment

                    • fris
                      Too lazy to set a custom title
                      • Aug 2002
                      • 55679

                      #11
                      good one ben ;)
                      Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                      Comment

                      • XX_RydeR
                        Confirmed User
                        • Jun 2004
                        • 2151

                        #12
                        Ah nice tip.

                        Though i wouldnt go sending them any type of message without first putting up something about
                        it on the blog, Terms or what not.
                        You Dun Goofed!

                        Comment

                        • Zuzana Designs
                          All Your Design Needs
                          • Feb 2005
                          • 20896

                          #13
                          Nice seeing some bizz on the board.. Thanks Fris ..

                          Website Design - Consulting - Development
                          sarah [at] zuzanadesigns.com - See Our Work

                          Comment

                          • pr0
                            rockin tha trailerpark
                            • May 2001
                            • 23088

                            #14
                            Originally posted by BigBen
                            Quality posts lately.

                            Here's another way using built-in WP functions so you don't have to mess with the mysql stuff (tested in 2.7):

                            Code:
                            <?php
                            require_once('example.com/wp-load.php');
                            
                            $email_list = $wpdb->get_results("SELECT DISTINCT comment_author_email FROM $wpdb->comments WHERE comment_author_email != ''");
                            foreach($email_list as $email) {
                                    echo $email->comment_author_email . "\n";
                            }
                            pwnd
                            __________
                            Loadedca$h - get sum! - Revengebucks - mmm rebills! - webair (gotz sErVrz)

                            Comment

                            Working...