I'm using 3 files to try and mass mail my members, massmail.php massmail-exe.php and elist.php
massmail.php
<form name="massmail" method="post" action="./massmail-exe.php">
<table width="450px">
<tr>
<td valign="top">
<label for="subject">Subject</label>
</td>
<td valign="top">
<input type="text" name="subject" maxlength="50" size="30" id="subject">
</td>
</tr>
<tr>
<td valign="top">
<label for="message">Email Content</label>
</td>
<td valign="top">
<textarea name="message" maxlength="9001" cols="100" rows="18" id="message"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
massmail-exe.php
<?php
// read the list of emails from the file.
$email_list = file("./elist.php");
// count how many emails there are.
$total_emails = count($email_list);
// go through the list and trim off the newline character.
for ($counter=0; $counter<$total_emails; $counter++) {
$email_list[$counter] = trim($email_list[$counter]);
}
// implode the list into a single variable, put commas in, apply as $to value.
$to = implode(",",$email_list);
if ( mail($to,$_POST["subject"],$_POST["message"]) ) {
echo "The email has been sent!";
} else {
echo "The email has failed!";
}
?>
and elist.php which has the email addresses.
What is wrong because every time i try and send it it say query failed.
Thanks so much.