Please help me in newsletter sending ,
this my code the problem is the mail is send to single person is going correctly ,if the same mail send to more number of persons getting wrong mail is going but the data display only in first mail ,the other mails getting decoded data please help me urgent,
In code i given comments for $mime_boundary i dont know its correct or not ,other wise please give me the code for newsletter for more number of peoples
thanks in advance
if(($_POST['group']<>'') && ($_POST['group']==0))
{
if($usrgroup='all')
{
$query="select email from cfair_adminusers order by admin_id";
$var=mysql_query($query);
while($arrayemail=mysql_fetch_array($var))
{
$emailid=$arrayemail['email'];
$to = $emailid;
$subject = $subject ;
$message=$message;
//$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
if($_FILES['filename']!='')
{
$tmp_name = $_FILES['filename']['tmp_name'];
$type = $_FILES['filename']['type'];
$name = $_FILES['filename']['name'];
$size = $_FILES['filename']['size'];
if(file_exists($tmp_name))
{
if(is_uploaded_file($tmp_name))
{
$file = fopen($tmp_name,'rb');
$data = fread($file,filesize($tmp_name));
fclose($file);
$data = chunk_split(base64_encode($data));
}
}
}
$headers .= 'From:superadmin@fair.com' . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"";
$headers .= 'Bcc: [email]admin@fair.com[/email]' . "\r\n";
'Reply-To: [email]sss@.solutin.com[/email]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(@mail($to, $subject, $message, $headers))
{
echo "Message Sent";
header("location:send_newsletter.php");
}
else
{
echo "Mail Not Sent";
}
}//while
}//if
}//if