rotwyla98 Posted November 22, 2006 Share Posted November 22, 2006 I have a table set up likeID | Name | Email1 | Tom | email1@yahoo.com2 | Rick | email2@hotmail.com3 | Frank | email3@gmail.com..1500 | Me | myemail@domain.comI am currently using the following code to email everyone on the list[code]<?php$db_hostname = 'localhost'; //Server where MySQL is running.$db_user = 'admin'; //Username to connect with.$db_pass = 'password'; //Password to connect with.$db_name = 'list'; //Name of database to connect to.$sql = mysql_connect($db_hostname, $db_user, $db_pass)or die("Connection Failure to Database");mysql_select_db($db_name, $sql) or die ($db_name . " Database not found. " . $db_user);$result = mysql_query("SELECT * FROM `users` WHERE `esent`= '0'") or die(mysql_error());while($row = mysql_fetch_array( $result )) {$name = $row['name'];$email = $row['email'];$to = "$email";$subject = "subject of the email";$message = "Dear $name,\nHey guys. Hope you enjoyed the free XXXXXXXX\n\nWell now I am opening up a new site at XXXXXXXX - It is going to have a XXXXXXXX.\n\nI encourage you all to join!\nSincerely,\n\t My Name\nPS. If you have any suggestions, feel free to email me back."; $headers = "To: $name <$email>" . "\r\n"; $headers .= "From: MyName <admin@domain.com>" . "\r\n";mail($to, $subject, $message, $headers);mysql_query("UPDATE `rune_users` SET `esent` = '1' WHERE `email`= '$email'");echo "Sent to $email<br/>";} mysql_close($sql);?>[/code]I doesnt seem to email everyone although it says that it has. I ran the script in a test table (3 users) and they got emails. When I do a big list (3k) and my email is last, I dont get one. I also received only about 3 hits in from emails so that tells me that not all of them were sent out.Did I do something wrong? Quote Link to comment Share on other sites More sharing options...
jawapro Posted November 22, 2006 Share Posted November 22, 2006 I'm not sure I want to help - sounds like a spammer to me ??? Quote Link to comment Share on other sites More sharing options...
rotwyla98 Posted November 22, 2006 Author Share Posted November 22, 2006 [quote author=jawapro link=topic=115824.msg471718#msg471718 date=1164159104]I'm not sure I want to help - sounds like a spammer to me ???[/quote]Im not. Dont worry about that. If I was a spammer, I would email until XXX,XXX emails in the db and wouldnt be using this script. I'm sending out these emails because I told the people I will be opening up a site and if they wanted me to email them when it went online. Now its online, I'm trying to send them an email and its not working =/ Quote Link to comment Share on other sites More sharing options...
jawapro Posted November 22, 2006 Share Posted November 22, 2006 Without seriously looking at the code (looks ok at first glance).Do you know if your server can email that many people? Often there would be some sort of limit to stop spammers.May or may not be the problem - but worth a thought.JP Quote Link to comment Share on other sites More sharing options...
rotwyla98 Posted November 22, 2006 Author Share Posted November 22, 2006 hmm... thats a possility... what would you say is the max # of emails I can send out at once? I could probably split them up and reload the page every X amount of emails sent. Quote Link to comment Share on other sites More sharing options...
jawapro Posted November 22, 2006 Share Posted November 22, 2006 I have no idea really. Could be anything from 20 - 1000 depending on the server and who set it up.The only ways to tell would be to ask whoever was in charge, or just try it at 20, then 40, then 80, then 100, then 150 etc and see when it dosnt work. And when it dosnt work, start going backwards until it works again (with your email at the end - so if you get one, you know it works).You said 3 worked, so at worst you could send three and then recall the same script - but that'd suck. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted November 22, 2006 Share Posted November 22, 2006 Use phpmailer.http://phpmailer.sourceforge.net/ Quote Link to comment Share on other sites More sharing options...
rotwyla98 Posted November 22, 2006 Author Share Posted November 22, 2006 [quote author=hitman6003 link=topic=115824.msg471743#msg471743 date=1164161514]Use phpmailer.http://phpmailer.sourceforge.net/[/quote]I looked into that but a lot of database changes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.