I am creating and sending a vcard as an email attachment using MIME. The .vcf file creates OK on the server, however when the email is delivered, the attached .vcf file contains no data, as read by outlook and outlook express (data exists in server file). I'm hoping the error is with my encoding.....Anyone with any ideas?

the code i am using is:

$to = "xxx@xxx.xxx";

$subject = "email subject";

$random_hash = md5(date('r', time()));

$headers = "From: yyy@yyy.yyy";

$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";

$attachment = chunk_split(base64_encode(file_get_contents("NewContact.vcf")));

$output = "
--PHP-mixed-$random_hash;
Content-Type: multipart/alternative; boundary='PHP-alt-$random_hash'
--PHP-alt-$random_hash
Content-Type: text/plain; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit

Text
--PHP-alt-$random_hash
Content-Type: text/html; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit

<h2>Text</h2>
<p>Text</p>

--PHP-alt-$random_hash--

--PHP-mixed-$random_hash
Content-Type: text/vcard; charset=utf-8; name=NewContact.vcf
Content-Transfer-Encoding: base64
Content-Disposition: attachment

$attachment
--PHP-mixed-$random_hash--";

echo @mail($to, $subject, $output, $headers);