Hello,
I have a php script which devide the emails in groups so that each group can send separately. Servers can look it as spam if the group is too big.
Now how can I add the correct email address of each person in this script below (cfr '. $ ??? .')
I hope somebody can help me with this. Please give code not just how to do it because I tried it for weeks now.
My php code so far without adding email receiver ...
$Newletter = "subject: $subject\nmessage:\n\n$message";
$Newletter = stripslashes($Newletter);
$Newletter = nl2br(htmlspecialchars(trim($Newletter)));
if($user == $_POST['user'] && $password == $_POST['password'] && $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$NewletterFile = file($dateFile);
$NewletterFileLenght = count($NewletterFile);
$groupsCounter = 0;
for($i = 0; $i < ($NewletterFileLenght+50); $i+=50)
{
$group = null;
$groupsCounter++;
for($a = $i; $a < ($i+50); $a++)
{
if($NewletterFile[$a])
{
$group .= trim($NewletterFile[$a]).",";
}
}
if($group) { $groups[] = $group; }
}
for( $i = 0; $i < count( $groups ); $i++ )
{
$to = $yourEmail;
$subject = stripslashes($_POST['subject']);
$_POST['message'] = str_replace("\n", "<br />", $_POST['message']);
$message = nl2br(stripslashes($_POST['message'])).'<br /><br /><br /><center>You received this message because you subscribed to our newsletter.<br />
The email address you entered is '. $???? .'<br />
To unsubscribe, <a href='. $Unsubscribe .'>click here</a>.<br />';
$headers .= 'Bcc:'."$groups[$i]". "\r\n";
$headers .= 'From:'.utf8_decode($yourWebsiteName).' <'.$yourEmail.'>' . "\r\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "Content-type: text/html; charset=utf-8\n";
mail( $to, $subject, $message, $headers );
}
Thanks in advance, you will do me a big favour.
Regards
Coderunner