fullyloaded Posted September 12, 2006 Share Posted September 12, 2006 hii was wonderinf if anyone knew where i can get a simple emailing list program that will hookup to my websites database i have a dating website and dont have this on there need it to send emails to my members thanks... Link to comment https://forums.phpfreaks.com/topic/20465-mailing-list/ Share on other sites More sharing options...
tomfmason Posted September 12, 2006 Share Posted September 12, 2006 Here is a simple one.[code]<?phpinclude("db.php"); // your database connection file$subject = "Some Subject";$headers = "FROM: [email protected]";$headers .= "MIME-Version: 1.0\r\n";$headers .= "Content-type: multipart/alternative;\r\n";$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";$headers .= "Content-Transfer-Encoding: 7bit";$headers .= "\r\n";$sql = mysql_query("SELECT * FROM `yourtable`") or die(mysql_error());$i = 0;while ($rw = mysql_fetch_assoc($sql)) { if ($i = 20) { sleep(1); $i = 0; } $message = 'Hello ' . $rw['username'] . ', This is a test mass mail.'; $to = $rw['email']; mail($to, $subject, $message, $headers); $i++;}mysql_free_result($sql);?>[/code]Hope this helps,Tom Link to comment https://forums.phpfreaks.com/topic/20465-mailing-list/#findComment-90203 Share on other sites More sharing options...
Potatis Posted January 26, 2008 Share Posted January 26, 2008 Sorry for bring up such an old post, but I guess this is what happens when you use the search function. :PThe script above works perfectly for me to be able to send a message to each person in my database to alert them when I have updated their points BUT ONLY if I write a single line message like in the example above.I have been trying to get multiple lines to work, but everything I try breaks the loop. The first user in the database gets the notification, and it formats perfectly, but no further emails are sent.This the code I tried to add:[code]$message = "Hello, \n\n";$message .="The quiz results have been processed! \n\n";$message .="Please visit http://domain.com/ to see how you fared against everyone else. \n\n";$message .="Admin \n\n";[/code]I have tried single quotes as well. Any ideas? Link to comment https://forums.phpfreaks.com/topic/20465-mailing-list/#findComment-449727 Share on other sites More sharing options...
Potatis Posted January 26, 2008 Share Posted January 26, 2008 Ah, ok, the multiple lines work when I remove the web address. It's a shame the web address breaks the loop, does anyone know if there is a syntax that will stop the web address from breaking the loop? Link to comment https://forums.phpfreaks.com/topic/20465-mailing-list/#findComment-449733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.