0

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);

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by digital-ether
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.