I am trying to get a mail/denounce type thing to work: There are mail groups, you join a mail group and leave a mail group, and you can send the whole mail group an email, by pressing a button, when you press the button you get directed to a page where you will put a form, then you click send
The following code runs:
$new_subject = $_POST['subject'];
$new_message = $_POST['message'];
// subject and message posted from the forum
if ($new_subject&&$new_message){
$query = mysql_query("SELECT * FROM mail_groups");
while($row=mysql_fetch_assoc($query)){
$id = $row['id'];
}
// Selects all mail groups, and gets their ID
$query6 = mysql_query("SELECT * FROM mail_group_members WHERE gid='$id'");
// Selects the members' email out of the specific mail group where the group id is ID
while($row3=mysql_fetch_assoc($query6)){
$send_to = $row3['email'];
// sets the send_to variable, which is different to each user (this is the user's email)
mail($send_to,$new_subject,$new_message,$headers);
// tries to send email, but nothing happens, no error messages, nothing
}
header("Location: mail.php");
// redirects to main mail page
}
I have set the SMTP server in php.ini (as my ISP-s)
Thanks for all help in advance