07 DB Into mass emailer

Results 1 to 8 of 8
  1. #1
    Apprentice nemboy55 is offline
    MemberRank
    Oct 2010 Join Date
    22Posts

    07 DB Into mass emailer

    Hey guys I have an 07 GunZ Database my old one with about 8-9k Emails
    Would anyone have a script or program to send Theys emails out :O?


  2. #2
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: 07 DB Into mass emailer

    How to Send Email from a PHP Script - About Email
    PHP MySQL - PHP MySQL Tutorial - Retrieve Data
    I have no knowledge about sql and php, but i would do a script that sens my message to all via collecting their email from db.

  3. #3
    Pee Aitch Pee Dave is offline
    MemberRank
    Mar 2011 Join Date
    The NetherlandsLocation
    722Posts

    Re: 07 DB Into mass emailer

    SELECT Email FROM Account, loop through it and send the mail to the email.

  4. #4
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: 07 DB Into mass emailer

    PHP Code:
    $data = mysql_query("SELECT Email FROM Account") 
    <?php
     $to 
    $data;
     
    $subject "Hi!";
     
    $body "Hi,\n\nHow are you?";
     if (
    mail($to$subject$body)) {
     
      echo("<p>Message successfully sent!</p>");
     
     } else {
     
      echo("<p>Message delivery failed...</p>");
     
     }
     
    ?>
    Is this right :P ? SuperWaffle?

  5. #5
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    Re: 07 DB Into mass emailer

    Use a while statement to loop through all results from the DB

  6. #6
    Die() Secured is offline
    MemberRank
    Sep 2011 Join Date
    /home/SDev/Location
    555Posts

    Re: 07 DB Into mass emailer

    The Bellow Script will send the exact same message to everyone.
    PHP Code:
    <?php

    //run query to get emails
    $query mssql_query('SELECT Email FROM Account');

    $data = array();

    while(
    $row mysql_fetch_array($query)) {
        $data[] = $row['email'];
    }

    //will seperate emails by comma so they can all be sent as once
    $to implode(", "$data);

    //from
    $from "no-reply@yourwebsite.com";

    //reply_to
    $reply_to "whodoyouwanttheusertoreplyto@yourwebsite.com";

    //Email Headers
    $headers  "From: " strip_tags($from) . "\r\n";
    $headers .= "Reply-To: "strip_tags($repy_to) . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

    //Email Subject
    $subject "Test mail";

    //Message May Include HTML sense its content type is defined as text/html in header
    $message "<b>Hello!</b><br /> This is a simple email message.";

    mail($to,$subject,$message,$headers);

    ?>

    I coded this without testing so ya, but I for that amount of emails I would use, PHPMailer or something that works well with sending bulk emails.

    EDIT:
    If you want to send customized messages to every user (like username in email) you can do so by,
    PHP Code:
    <?php

    //run query to get emails
    $query mssql_query('SELECT * FROM Account');

    //from
    $from "no-reply@yourwebsite.com";

    //reply_to
    $reply_to "whodoyouwanttheusertoreplyto@yourwebsite.com";

    //Email Headers
    $headers  "From: " strip_tags($from) . "\r\n";
    $headers .= "Reply-To: "strip_tags($repy_to) . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

    //I would put subject here if its not different for every user else u can put it in the while() loop.
    $subject "Test mail";

    while(
    $row mysql_fetch_array($query)) {
        
    //Email Subject
        
    $message "<b>Hello!</b><br /> This is a simple email message. <br />Your username is"$row['UserID'];
        
    mail($row['email'],$subject,$message,$headers);
    }

    ?>
    Last edited by Secured; 30-12-12 at 02:55 AM.

  7. #7
    Its Friday :D! trunksx is offline
    MemberRank
    Feb 2007 Join Date
    PerúLocation
    232Posts

    Re: 07 DB Into mass emailer

    send just 30 emails you will get blacklisted for the spam filters

  8. #8
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: 07 DB Into mass emailer

    This is a really bad idea, and if I got a mass e-mail spam I would stay away from whatever content that e-mail is trying to advertise. Scumbag way to get your info out. Never mass e-mail.



Advertisement