Trying to build contact page. I would like to be able to send multiple emails in one time. email addresses have been pulled in from database. I am managing getting them all with do while. However to add "bcc" all addresses I need them to be in one variable for example $emails. I cannot seem to figure out how to do that. This is what I have so far:
$username = $_POST['Username'];
$email = $_POST['email'];
$to="email goes here";
$from= $_POST['email'];
$subject= "Raiding Team Announcement";
$footer="© Copyright 2015 All Rights Reserved ";
$message .= '<html><body>';
$message .= '<div style="width:100%; background-color:#333;">';
$message .= '<h1 style="font-size:50px; color:#FFCC00; text- align:center; display:block; padding-bottom:15px; border-bottom:1px solid #AA0114; ">HellscreamsFury</h1>';
$message .='<h2 style="font-size:32px;color:#f37e0e; text-align:center;">' .$_POST["Username"].' says:</h2>';
$message .='<div style="margin:30px; padding:10px; border:1px solid #404040; margin-bottom:50px;">';
$message .='<p style="font-size:18px; color:#ccc;">' .$_POST["message"]. '</p>';
$message .= '</div>';
$message .= '<div style="border-top:1px solid #AA0114;">';
$message .='<p style="font-size:12px; color:#fff; text-align:center; padding: 20px 0 50px 0;">' .$footer. '</p>';
$message .= '</div>';
$message .= '</div>';
$message .= '</body></html>';
$headers .= "From: " . $from . "
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
if(mail($to,$subject,$message,$headers)){
header("Location: ../announcments.php?aid=43");
}
else{
header("Location: ../announcments.php?aid=44");
}
This snippet pulls in my emails:
<?php do { ?>
<?php echo $row_rs_contact_team['email']; ?>
<?php } while ($row_rs_contact_team = mysql_fetch_assoc($rs_contact_team)); ?>
I would need them to sit in one variable - let's say $emails. How do I do that? Also emails are pulled in while checking user_id, but sometimes user_id repeats - is there a way to pull that email in once instead of pulling let's say three times?