Hello i am trying to make a simple email script but its not working!
What i want it to do is Select the emails from a database and use that to send to those people!
This is the code
[php]<?php
$to = ‘[email protected]’;
$field_subject = $_POST[‘subject’];
$field_comment = $_POST[‘comment’];
$headers = 'From Jaap Scholten '."\r\n";
$field_pic = $_FILES[“file”];
$field_everything = $field_comment;
$con = mysql_connect(“gjosse.nl.mysql”,“gjosse_nl”,“NOTGOINGTOTELL”);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}
$data = mysql_select_db(“gjosse_nl”, $con);
if(!$data)
{
?>
alert(“cound not conect to database!”);
window.location = ‘index.html’;
</script>
<?php
}
$result = mysql_query(“SELECT * FROM Emails”);
function emaillist()
{
while($row = mysql_fetch_array($result))
{
echo $row[‘Email’];
echo " ,";
}
}
$mailstats = mail(emaillist(),$field_subject,$field_everything,$headers);
if($mailstats)
{
echo “Email sent!”;
}
else
{
echo “Email failed”;
}
?>
[/php]
Thanks For Helping!