Php mail - attachment is corrupt unless html content is extensive?

This is so odd… Hello, I am so confused by this email issue Im having. I use the below code to email a single zip file, and it works ONLY if my html content is extensive (like 40 or so lines of content)…

If I shorten it to just a paragraph, I still receive the email, and the attachment, but the attachment will not extract, it says corrupt. ?? that doesnt make sense to me.

Ive spent 2 days trying to find another script, but I tried phpmailer and I cant get that to even email me at all, but most likely because I dont understand the smtp part of it. im guessing.

I know this is just a long shot, but I still posted just in case someone actually has heard of this happenning before…

// -------------------------------------------------------------
$random_hash = md5(date('r', time())); 
$headers = "From: [email]abc@mysite.net[/email]\\r\
Reply-To: [email]abc@mysite.net[/email]"; 
$headers .= "\\r\
Content-Type: multipart/mixed; boundary=\\"PHP-mixed-".$random_hash."\\""; 
//read the atachment file contents into a string,
//encode it with MIME base64,
//and split it into smaller chunks
$attachment = chunk_split(base64_encode(file_get_contents('pkg_intro.zip'))); 
//define the body of the message. 
ob_start(); //Turn on output buffering ?> 

--PHP-mixed-<?php echo $random_hash; ?>  
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>" 

--PHP-alt-<?php echo $random_hash; ?>  
Content-Type: text/plain; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit

Dear blah blah blah blah , my content

--PHP-alt-<?php echo $random_hash; ?>  
Content-Type: text/html; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit

   <p>testing testing  html content</p>


--PHP-alt-<?php echo $random_hash; ?>-- 

--PHP-mixed-<?php echo $random_hash; ?>  
Content-Type: application/zip; name="pkg_intro.zip"  
Content-Transfer-Encoding: base64  
Content-Disposition: attachment  

<?php echo $attachment; ?> 
--PHP-mixed-<?php echo $random_hash; ?>-- 

<?php 
//copy current buffer contents into $message variable and delete current output buffer 
$message = ob_get_clean(); 
//send the email 
$mail_sent = @mail( $to, $subject, $message, $headers ); 
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
echo $mail_sent ? "Mail sent" : "Mail failed";