Nieuw lid |
|
Hoi,
Ik wil een email met bijlage (wordt ge-upload) naar veel mensen sturen +- 300 keer.
Ik heb het met bcc geprobeerd, maar het wordt telkens maar naar 1 bcc gestuurd. Snap dat echt niet meer.
Mijn vraag is hoe de server gaat reageren als ik nu zoveel keer een mail verstuur door het in een loop te plaatsen. Gaat dat wel goed?
Dit is het script wat ik nu heb:
<?
$email = substr_replace($email, '', 0, 1);
$to_array = explode(",", $email);
$aantal_mails = count($to_array);
for($i=0;$i<count($to_array);$i++) {
$mailman = "";
$send_date = date("r",time());
$bdate = time();
$bound = "000-".$mailman."-".$bdate."";
$from_mail = "info@test";
$from_real = "Test";
$to_mail = $to_array[$id];
$to_real = "";
$subject = stripslashes($_POST['onderwerp'])."\n";
$msg = "\r\n<font style='font-family: verdana,arial,sans-serif; font-size: 10px;'><img src=http://www.test.nl/img/logo_oud.gif><br><br>".$_POST['emailbericht']."";
// attachment stuff
$tmp_name = $_FILES['bijlage']['tmp_name'];
$type = $_FILES['bijlage']['type'];
$name = $_FILES['bijlage']['name'];
$size = $_FILES['bijlage']['size'];
upload("uploads",$tmp_name,$name,"y",$name);
$head = "Date: $sent_date\n";
$head .= "From: ".$from_mail."\n";
//$head .= "To: ".$email_loop."\r\n";
//$head .= "CC: \"".$cc_real."\" <".$cc_mail.">\r\n";
//$head .= "BCC: ".$bcc_mail."\r\n";
$head .= "X-Priority: 1 (High)\n";
$head .= "X-Mailer: <My Mail Server>\n";
$head .= "MIME-Version: 1.0\n";
$head .= "Content-Type: multipart/mixed; boundary=\"$bound\"\n\n";
$body = "This is a multi-part message in mime format\n\n";
$body .= "--".$bound."\n";
$body .= "Content-type: text/html; charset=iso-8859-1\"\n";
$body .= "Content-Transfer-Encoding: 8bit;\n\n";
$body .= "".preg_replace("/\r\n/i", "\n", $msg)."\n\n";
$body .= "--".$bound."\n";
$body .= "Content-Type: application/octet-stream\n";
$body .= "Content-Transfer-Encoding: base64\n";
$body .= "Content-Disposition: attachment; filename=\"".$name."\"\n\n";
set_magic_quotes_runtime(0);
$attach = $name;
$fl = "uploads";
$attachment = fread(fopen("$fl/$attach", "rb"), filesize("$fl/$attach"));
$attachment = chunk_split(base64_encode($attachment));
$attachment = preg_replace("/\r\n/i", "\n", $attachment);
$body .= "$attachment";
$body .= "\n";
$body .= "--".$bound."--\n\n";
if(mail($to_mail, $subject, $body, $head)) {
$succes++;
}
}
?>
<? $aantal_mails = count($to_array); for($i=0;$i<count($to_array);$i++) { $mailman = ""; $bound = "000-".$mailman."-".$bdate.""; $from_mail = "info@test"; $from_real = "Test"; $to_mail = $to_array[$id]; $to_real = ""; $msg = "\r\n<font style='font-family: verdana,arial,sans-serif; font-size: 10px;'><img src=http://www.test.nl/img/logo_oud.gif><br><br>".$_POST['emailbericht'].""; // attachment stuff $tmp_name = $_FILES['bijlage']['tmp_name']; $type = $_FILES['bijlage']['type']; $name = $_FILES['bijlage']['name']; $size = $_FILES['bijlage']['size']; upload("uploads",$tmp_name,$name,"y",$name); $head = "Date: $sent_date\n"; $head .= "From: ".$from_mail."\n"; //$head .= "To: ".$email_loop."\r\n"; //$head .= "CC: \"".$cc_real."\" <".$cc_mail.">\r\n"; //$head .= "BCC: ".$bcc_mail."\r\n"; $head .= "X-Priority: 1 (High)\n"; $head .= "X-Mailer: <My Mail Server>\n"; $head .= "MIME-Version: 1.0\n"; $head .= "Content-Type: multipart/mixed; boundary=\"$bound\"\n\n"; $body = "This is a multi-part message in mime format\n\n"; $body .= "--".$bound."\n"; $body .= "Content-type: text/html; charset=iso-8859-1\"\n"; $body .= "Content-Transfer-Encoding: 8bit;\n\n"; $body .= "--".$bound."\n"; $body .= "Content-Type: application/octet-stream\n"; $body .= "Content-Transfer-Encoding: base64\n"; $body .= "Content-Disposition: attachment; filename=\"".$name."\"\n\n"; $attach = $name; $fl = "uploads"; $body .= "$attachment"; $body .= "\n"; $body .= "--".$bound."--\n\n"; if(mail($to_mail, $subject, $body, $head)) { $succes++; } } ?>
|