Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13

Thread: AUTO mailer

  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation AUTO mailer

    Hey, i was wondering if anyone knows a good Auto mailer code.. i just need a code so when i go to the webpage it will send all the e-mails, i dont need anything extra.. i got a list of emails in my database, and i need to send emails to everyone at once.. i got 3000+ emails.. so yea, it needs to be auto :P

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts
    someone help please...

  • #3
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    PHP Code:

    for($i=0$i<=$num$i++) {

      
    $email mysql_result($result$i"email"); // The email in the database...
      
    $subject ""// Apply your subject
      
    $message =""// Apply your message
      
    $headers =""// Apply your headers

      
    if($i 20) { echo "\n\n<p>Zzz...</p>\n\n"sleep(10); }
      
      if(
    mail($email$subject$message$headers)) {
        echo 
    "<b>".number_format($i)."</b>: ".$email."<br>\n";
      } else {
        echo 
    "<b>".number_format($i)."</b> FAILED: ".$email."<br>\n";
      }


    Last edited by Element; 01-12-2006 at 11:20 PM.

  • #4
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ok.. that sort of works.. that code only sends to the first person in the list.. i need it to send to all 3000 :P

  • #5
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts
    nobody knows how to do this?

  • #6
    zis
    zis is offline
    New Coder
    Join Date
    Dec 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's PHP list it's a complete newsletter engine.. but it has a good mail sending engine with reports time outs and failsafes. Give it a look here:
    http://tincan.co.uk/phplist

  • #7
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thats way too complicated... i just want one easy script.. like..

    $link = "SELECT * FROM mailinglist";
    $res = mysql_query($link) or die(mysql_error());
    $email = mysql_result($res,$i,"email");

    $msg = "Dear player of Medieval: The Dark Ages,";
    $msg.= "\n";
    $msg.= "You have played the previous age with us, but this age you haven't signed up again.\n";
    $msg.= "We invite you to come and play Medieval: The Dark Ages again.\n"; $msg.= "\n";
    $msg.= "The Earth was young, but was without a leader, it was every man for himself. Mighty warriors fought for control over land, but destroyed everything in their paths. Build up your army to defend your base and pillage and plunder others. Mine for gold, then purchase a range of weapons and armour to help lead an assault on an enemy.\n";
    $msg.= "\n";
    $msg.= "http://www.medieval-tda.net/\n";
    $msg.= "\n";
    $msg.= "-Administration\n"; mail($retval['email'],"Medieval: The Dark Ages",$msg,"From: do-not-reply-".$emailnr."@medieval-tda.com");


    But with an auto sender, so there would be somthing like while() at the end.. but im not sure what to do.. i just need a simple code...

  • #8
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    PHP Code:

    $query 
    "SELECT * FROM mailinglist"
    $result mysql_query($query); 
    $num mysql_num_rows($result);

    for(
    $i=0$i<=$num$i++) {

      
    $email mysql_result($result$i"email"); // The email in the database...
      
    $subject ""// Apply your subject
      
    $msg "Dear player of Medieval: The Dark Ages,"
      
    $msg.= "\n"
      
    $msg.= "You have played the previous age with us, but this age you haven't signed up again.\n"
      
    $msg.= "We invite you to come and play Medieval: The Dark Ages again.\n"$msg.= "\n"
      
    $msg.= "The Earth was young, but was without a leader, it was every man for himself. Mighty warriors fought for control over land, but destroyed everything in their paths. Build up your army to defend your base and pillage and plunder others. Mine for gold, then purchase a range of weapons and armour to help  lead an assault on an enemy.\n"
      
    $msg.= "\n"
      
    $msg.= "http://www.medieval-tda.net/\n"
      
    $msg.= "\n"
      
    $msg.= "-Administration\n"mail($retval['email'],"Medieval: The Dark Ages",$msg,"From: do-not-reply-  ".$emailnr."@medieval-tda.com");
      
    $headers =""// Apply your headers

      
    if($i 20) { echo "\n\n<p>Zzz...</p>\n\n"sleep(10); }
      
      if(
    mail($email$subject$msg$headers)) {
        echo 
    "<b>".number_format($i)."</b>: ".$email."<br>\n";
      } else {
        echo 
    "<b>".number_format($i)."</b> FAILED: ".$email."<br>\n";
      }



  • #9
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts
    THANK you sooooooo much!!!!!! needless to say, that worked

  • #10
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ok.. a tiny little addon thing.. i couldnt finish sending them, as i have 3000 to send, i only got about half sent out... can i pick off where i left off? like where it says
    Code:
    $query = "SELECT * FROM mailinglist"; 
    $result = mysql_query($query); 
    $num = mysql_num_rows($result);
    could i add a where email='personsemail'???

  • #11
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    No, because that will just fetch that persons row. What you need to do, is use the row number, which is safe to say is the number being outputted before the users email addross, if you can remember that you can add a option like, if isset($_GET['continue']) then you would trigger a seperate query instead of the original like:

    PHP Code:
    if(isset($_GET['continue'])) {
      
    $query "SELECT * FROM mailinglist LIMIT ".$_GET['continue'].", COUNT(id)";
    } else {
      
    $query "SELECT * FROM mailinglist";

    Also, with this code you need to reset the for() statement to count from where its at, so we're do something like:

    PHP Code:
    $start $_GET['continue'] ? $_GET['continue'] : 0
    which should go under your $num variablne, then in the for() statement:

    PHP Code:
    for($i=$start$i<=$num$i++) { 
    Not sure if that will work, you can give eit a try. $_GET['continue'] is the row where the script timed out.
    Last edited by Element; 01-13-2006 at 08:21 PM.

  • #12
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you mean send bulk mails? Here is a tutorial send bulk mails through php

  • #13
    Regular Coder
    Join Date
    Jan 2006
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I did what you said element, but i got:

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /var/ftp/galacticoddessy.com/httpdocs/sendmailto.php on line 17
    0:

    line 17 is:
    Code:
    $email = mysql_result($start, $i, "email"); // The email in the database...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •