topflight Posted March 9, 2009 Share Posted March 9, 2009 I currently have 4 groups in my database and I want to have it set up so if the admin select one group and type a message in, it will email all the members in that group, but if the admin select ALL members it will email all member. I already have the form made out but I am confused on how to get started on this. Please help. Thanks in Advanced! Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/ Share on other sites More sharing options...
topflight Posted March 9, 2009 Author Share Posted March 9, 2009 any help? Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780564 Share on other sites More sharing options...
jackpf Posted March 9, 2009 Share Posted March 9, 2009 Well, something like this...? $sql = mysql_query("SELECT * FROM table WHERE group='whatever'"); while($fetch = mysql_fetch_array($sql)) { //Insert stuff into the message table here... } Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780595 Share on other sites More sharing options...
topflight Posted March 9, 2009 Author Share Posted March 9, 2009 I guess not do I just put the email stuff like to from and everything like that between the curly brackets also How can I use the BCC feature? Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780599 Share on other sites More sharing options...
jackpf Posted March 9, 2009 Share Posted March 9, 2009 Oh right...an actual email; I thought you meant like, your own private messaging system. And yes, that's exactly what you'd do. For more info, check this out. Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780617 Share on other sites More sharing options...
redarrow Posted March 9, 2009 Share Posted March 9, 2009 what the name off the four groups please. Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780625 Share on other sites More sharing options...
topflight Posted March 9, 2009 Author Share Posted March 9, 2009 a b c d Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780755 Share on other sites More sharing options...
redarrow Posted March 10, 2009 Share Posted March 10, 2009 Here a grate example i just done for you. Donation page is on the forum .... enjoy......... <?php //database connection. if(isset($_POST['submit'])){ $update_group=trim(mysql_real_escape_string($_POST['update_group'])); $sql="SELECT * FROM what_evaer where group='$update_group'"; $res=mysql_query($sql)or die("There a select problam".mysql_error()); if(mysql_num_rows($res)){ while($group_data=mysql_fetch_assoc($res)){ $to = $group_data['group_email_address']; $mess="bla blaa blaaa blaaa blaaaaaa blaaaaaaaaaaa!"; $message=$mess; $subject = 'This is a email from who_ever.!'; $headers = 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; echo"You have sent email to the current email address:"; if(mail($to, $subject, $message, $headers)){ echo"<br>$to<br>"; exit; } } } } echo" <form method='POST' action='{$_SERVER['PHP_SELF']}'>"; echo "<center><select name='update_group'><option value=' '>Selected</option>"; $select_array=array("a","b","c","d"); foreach($select_array as $array_selected){ echo"<option value='$array_selected'>$array_selected</option>"; } echo"</select><br><br>"; echo "<input type='submit' name='submit' value='Send the update via a group'>"; echo"</center></form>"; ?> Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780780 Share on other sites More sharing options...
ferret147 Posted March 10, 2009 Share Posted March 10, 2009 Would there be away of limiting the number of users this sends an email to! For example you tap in your message click submit and it sends to the first 100 email address in the database then you have to click a continue button or something to send to the next 100. Just that if you have say 10,000 people in your database the server will not like that and it may crash. Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780787 Share on other sites More sharing options...
redarrow Posted March 10, 2009 Share Posted March 10, 2009 Let the code sleep() <<<clue. http://uk.php.net/sleep Link to comment https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/#findComment-780803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.