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 [email protected] "; mail($addy, $subject, $message, "From: <[email protected]>")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> Link to comment https://forums.phpfreaks.com/topic/37938-email-php-help/ 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? Link to comment https://forums.phpfreaks.com/topic/37938-email-php-help/#findComment-181579 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..! Link to comment https://forums.phpfreaks.com/topic/37938-email-php-help/#findComment-181582 Share on other sites More sharing options...
Jessica Posted February 10, 2007 Share Posted February 10, 2007 mail($addy, $subject, $message, "From: <[email protected]>")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. Link to comment https://forums.phpfreaks.com/topic/37938-email-php-help/#findComment-181584 Share on other sites More sharing options...
grlayouts Posted February 11, 2007 Author Share Posted February 11, 2007 still not working. Link to comment https://forums.phpfreaks.com/topic/37938-email-php-help/#findComment-181814 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 Link to comment https://forums.phpfreaks.com/topic/37938-email-php-help/#findComment-181817 Share on other sites More sharing options...
grlayouts Posted February 12, 2007 Author Share Posted February 12, 2007 yes its def a script problem.. Link to comment https://forums.phpfreaks.com/topic/37938-email-php-help/#findComment-182602 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.