Jump to content

email php help!!


grlayouts

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.