I built a database site for certain artists to join and im trying to create a page where i can type a message and then have that message emailed to everyone in the MySQL database. i tested the script i wrote just using two of my emails and it just sent the message to one, 70 times. i then tried using the $result variable from the MySQL query as the 'to email' but that did nothing. here's the script, form included, i know im not including something:
<?php # Script group_email.php (admin side)
require_once ('../includes/config.inc');
require_once ('../../authentication.php');
$page_title = ':: SEND GROUP EMAIL ::';
include_once ('../includes/admin_header.htm');
if (!$authorized) {
echo '<span class="errors"><br><br>Please enter a valid username and password. Click <a href="index.php">here</a> to try again.<br><br></span>';
} else {
require_once ('../../mysql_connect.php');
}
$query = "SELECT email FROM users";
$result = @mysql_query ($query);
$num = mysql_num_rows ($result);
$body = "This is a message from the Active Artists Alliance: '{$_POST['message']}'";
mail ($result, 'Active Artists Alliance', $body, 'From: [email]admin@activeartist.org[/email]');
?>
<tr>
<th width="180" valign="top" bgcolor="#CCCCCC" class="sideBody" scope="col"><p align="left"><span class="sideHeads">ADMIN AREA</span><br>
<a href="view_users.php">View members</a><br>
<a href="view_files.php">View uploaded files</a><br>
<a href="poll_admin.php">Poll admin</a><br>
<a href="../index.php">Site Home</a><br><br></p>
</th>
<th colspan="2" valign="top" bgcolor="#FFFFFF" class="bodycopy" scope="col" align="left">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table width="100%" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
<tr>
<th width="100%" valign="top" scope="col"><div align="left" class="bodycopy">
Enter your message below<br><textarea name="message" cols="40" rows="10"></textarea><br><input name="submit" type="submit" value="send email"><br>
</span>
</div></th>
</tr>
</table>
</form></th>
</tr>
</th>
</table>
<?php
include_once ('../includes/admin_footer.htm');
?>