grlayouts Posted February 10, 2007 Share Posted February 10, 2007 I want a script that will send an email to all my users in the database except staff.. however its not working! anyone? <? include ("header.php"); $title = "email users"; if ($action == "send"){ $user=$_SESSION['user']; $select=mysql_query("SELECT * FROM players WHERE user='$user'"); $p=mysql_fetch_object($select); $i8n=mysql_query("SELECT * FROM players WHERE rank != 'Staff'"); $text=strip_tags($_POST['mass_msg']); if(!$text){ }else{ while($object = mysql_fetch_object($i8n)){ $addy=$object[email]; $subject = "HoboTown Newsletter"; $message = "Dear $object[user], <br> $text <br> Thanks! HoboTown Staff E-Mail From $stat[user] Part Of The HoboTown Administration Team.<br> If You See This Message Isnt From HoboTown Please Contact paul@designanyone.com "; mail($addy, $subject, $message, "From: <staff@hobotown.co.uk>")or die(mysql_error()); print "Message Sucessfully Sent To $object[user] - $object[email]<br>"; } print "Done"; } } ?> <html> <form method="post" action="newsletter.php?action=send"> Message To Send:<br> <textarea name="mass_msg" cols="40" rows="7" id="mass_msg"></textarea> <br><input type="submit" value="E-Mail All Users"> </form> </html> Quote Link to comment Share on other sites More sharing options...
almightyegg Posted February 10, 2007 Share Posted February 10, 2007 What's not working? Does it show any errors? Quote Link to comment Share on other sites More sharing options...
grlayouts Posted February 10, 2007 Author Share Posted February 10, 2007 no.. it doesnt send. i get nothing..! Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 10, 2007 Share Posted February 10, 2007 mail($addy, $subject, $message, "From: <staff@hobotown.co.uk>")or die(mysql_error()); Firstly, mysql_error() ONLY has to do with MYSQL functions. mail() returns either true or false, based on if it was accepted for delivery. $addy=$object; needs to be $addy=$object['email']; - same with the rest of your arrays[]. It may have gone into your spam folder. If it's not there, contact your webhost, and ask them for help. Quote Link to comment Share on other sites More sharing options...
grlayouts Posted February 11, 2007 Author Share Posted February 11, 2007 still not working. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 11, 2007 Share Posted February 11, 2007 have you checked with your host, is their mail enabled? Ted Quote Link to comment Share on other sites More sharing options...
grlayouts Posted February 12, 2007 Author Share Posted February 12, 2007 yes its def a script problem.. 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.