Help with mass-mailer

Hi,

I made a mass-mailer in php, it sends out a html-mail and a text-message at once. So that people who cannot read html-messages get the txt-msg instead.

Now, it works pretty well, but sometimes, weird things happen that I can’t explain.

For example, the last mailing for my company was sent out this way, and in the 10 or so test-mails everything went right. But when we added +/- 100 client-mail-adresses, the e-mail was received as txt-mail (with headers and everything), and the html below also as text.

My guess is that it’s something in the code that’s responsible for sending out.
I post hereby the code, the info gets sent thru via a form on the previous page.

Can anybody help ?

$notice_text = "This is a multi-part message in MIME format.";
$plain_text = $text_message;
//$html_text = $html_message;
//stripslashes("$html_text");
$html_text = str_replace("\\","",$html_message);

$semi_rand = md5(time());
$mime_boundary = "==MULTIPART_BOUNDARY_$semi_rand";
$mime_boundary_header = chr(34) . $mime_boundary . chr(34);

$to = $to_field;
$bcc = $bcc_field;
$from = $from_name . " <" . $from_address . ">";
$subject = $subject;

$body = "$notice_text

--$mime_boundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

$plain_text

--$mime_boundary
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

$html_text

--$mime_boundary--";

if (@mail($to, $subject, $body,
    "From: " . $from . "
" .
    "bcc: " . $bcc . "
" .
    "MIME-Version: 1.0
" .
    "Content-Type: multipart/alternative;
" .
    "     boundary=" . $mime_boundary_header))
    echo "Email sent successfully.";
else
    echo "Email NOT sent successfully!";