I have a newsletter that sends out a notification to members with in 30 days of expiring. The way it works is the script populates an <option> from the members table who fall with in the thirty days. All I want to do is be able mask the $to recipients and use bcc.
code below: any hep would be much appreciated.
<?php
include "../includes/db.php";
include "../includes/function.php";
checkAdminLogin();
include "header.php";
include "../fckeditor/fckeditor.php";
$db = new Database();
$db->connect();
$error = "";
$emails = "";
$arr = array();
if( count($_POST) )
{
if( !empty($_POST['txtSUB']) && !empty($_POST['msgDESC']) && !empty($_POST['cmbEmail']))
{
$emails = "1";
if( $emails == "1" )
{
$to = "";
foreach( $_POST['cmbEmail'] as $v )
{
$to .= $v . ", ";
}
$sub = sql_replace($_POST['txtSUB']);
$msg = sql_replace($_POST['msgDESC']);
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: [email]administrator@beneteaufirst367.org[/email]' . "\r\n";
if( @mail($to, $sub, $msg, $headers ) )
{
echo "<script type='text/javascript'>
alert('Newsletter has been sent to your selected members');
window.location.href = 'member_exp.php';
</script>";
}
else
{
echo "<script type='text/javascript'>
alert('Error while sending newsletter, please try again latter');
</script>";
}
}
}
else
{
$error = " • All fields are required<br>";
}
}
?>