scarlson Posted February 11, 2008 Share Posted February 11, 2008 Anyone have any ideas they can share with me as to the best way to create some sort of script that would grab all the email addresses from my database and email them a newsletter? Doesn't need to be anything special. Thanks, Scott Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/ Share on other sites More sharing options...
trq Posted February 11, 2008 Share Posted February 11, 2008 <?php // connect to db. $sql = "SELECT email FROM tbl"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { if (mail($row['email'],'subject','message')) { echo "Mail sent to {$row['email']}\n"; } else { echo "Failed to send mail to {$row['email']}\n"; } } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/#findComment-463628 Share on other sites More sharing options...
mforan Posted December 1, 2008 Share Posted December 1, 2008 aditionally to this, is it possible to use this code to email 10000 users? Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/#findComment-702657 Share on other sites More sharing options...
.josh Posted December 1, 2008 Share Posted December 1, 2008 nope. mysql_fetch_assoc has an internal logic switch to ensure that people cannot spam. Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/#findComment-702661 Share on other sites More sharing options...
mforan Posted December 1, 2008 Share Posted December 1, 2008 hmmm how would one go about emailing that many users then :/ Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/#findComment-702662 Share on other sites More sharing options...
.josh Posted December 1, 2008 Share Posted December 1, 2008 well, you could setup that script on an entirely different server for every 100 or so users Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/#findComment-702666 Share on other sites More sharing options...
waynew Posted December 1, 2008 Share Posted December 1, 2008 Yea. Rent out ten servers and email 100 users from each! Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/#findComment-702671 Share on other sites More sharing options...
.josh Posted December 1, 2008 Share Posted December 1, 2008 10k users = 100 servers. Quote Link to comment https://forums.phpfreaks.com/topic/90434-how-to-create-a-script-to-mass-email-all-users/#findComment-702672 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.